Exemplo n.º 1
0
 // 加载 xml 文件到内存,构建要编译的模块文件
 public void LoadDetailList()
 {
     // 清空列表
     Dls.Clear();
     #region 读取xml文件,重建 alModule
     XmlDocument xmldoc = new XmlDocument();
     xmldoc.Load(detaillist);
     XmlNode     xn  = xmldoc.SelectSingleNode("detail");
     XmlNodeList xnl = xn.ChildNodes;
     foreach (XmlNode x in xnl)
     {
         // 构建 Excel 列表文件
         Detail dl = new Detail(x.Name, x.Attributes["file"].InnerText,
                                x.Attributes["sql"].InnerText, x.Attributes["pas"].InnerText);
         Dls.Add(dl);
     }
     #endregion
 }
Exemplo n.º 2
0
        // 编译Excel文件或者后台Sql
        private bool CompileExcel(CommitCom c)
        {
            // 确定详细设计说明书文件
            MacroType m;
            Detail    d = Dls.FindByName(c);

            if (d == null)
            {
                log.WriteErrorLog("查找不到对应的详细设计说明书模块!");
                return(false);
            }

            // 标定index
            bool Result = true;
            int  index  = Dls.IndexOf(d) + 1;

            // 先把存在的CError删除,以检测是否发生编译错误
            if (File.Exists(Path.Combine(OutDir, "CError.txt")))
            {
                File.Delete(Path.Combine(OutDir, "CError.txt"));
            }

            // 编译Excel 最耗时,对Excel检查是否需要编译,比较PC文件
            bool     bNew = false;
            DateTime t2   = File.GetLastWriteTime(c.sawfile.LocalPath);
            DateTime t1   = t2.AddSeconds(-1);

            if (c.ctype == ComType.SO)
            {
                foreach (string s in d.ProcFiles)
                {
                    t1 = File.GetLastWriteTime(Path.Combine(OutDir, s));
                    if (DateTime.Compare(t1, t2) > 0)
                    {
                        bNew = true;
                        break;
                    }
                }
            }
            else if (c.ctype == ComType.Sql || c.ctype == ComType.FuncXml)
            {
                if (c.ctype == ComType.Sql)
                {
                    t1 = File.GetLastWriteTime(Path.Combine(OutDir, d.SqlFile));
                }
                else
                {
                    t1 = File.GetLastWriteTime(Path.Combine(OutDir, d.XmlFile));
                }

                if (DateTime.Compare(t1, t2) > 0)
                {
                    bNew = true;
                }
            }

            if (bNew)
            {
                log.WriteLog("本地源代码时间晚于Excel文件时间,不需集成处理!" + c.cname + " " + c.ctype);
                return(true);
            }

            if (c.ctype == ComType.SO)
            {
                m = MacroType.ProC;
            }
            else if (c.ctype == ComType.Sql)
            {
                m = MacroType.SQL;
            }
            else if (c.ctype == ComType.FuncXml)
            {
                m = MacroType.FuncXml;
            }
            else
            {
                return(true);
            }

            Result = Exh.ScmRunExcelMacro(m, index, OutDir);

            if (!Result)
            {
                return(false);
            }
            else if (File.Exists(Path.Combine(OutDir, "CError.txt")))
            {
                Result = false;
                log.WriteErrorLog("检测到编译错误文件 CError.txt,请确认!");
            }

            return(Result);
        }
Exemplo n.º 3
0
 public override Detail GetDetail(CommitCom c)
 {
     return(Dls.FindByName(c));
 }