コード例 #1
0
ファイル: PjtfFile.cs プロジェクト: radtek/SLBZ
        /// <summary>
        /// 获取pjtf的印刷纸张大小
        /// </summary>
        /// <returns></returns>
        public CREO_TrimBox_MilliMetre GetPressSheetSize()
        {
            FileStream              fs      = null;
            StreamReader            sr      = null;
            CREO_TrimBox_MilliMetre trimBox = new CREO_TrimBox_MilliMetre
                                                  (new MilliMetre_Unit(0), new MilliMetre_Unit(0), new MilliMetre_Unit(0), new MilliMetre_Unit(0));

            try
            {
                FileInfo fileInfo = this.PjtfFileInfo;
                //确定trimBox
                fs = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

                string seekString = sr.ReadToEnd();
                //释放流
                {
                    sr.Close();
                    fs.Close();
                }
                Regex regex = new Regex(@"/SSiPS \[(\d+\.?\d* ){4}\]");
                //找到表示'印刷纸张大小'的数据,经过测试:这个数据是唯一的,不存在第二个数据
                Match match = regex.Match(seekString);
                if (match.Success)
                {
                    regex = new Regex(@"\d+\.?\d*");
                    MatchCollection mc = regex.Matches(match.Value);
                    if (mc.Count == 4)
                    {
                        trimBox = new CREO_TrimBox_MilliMetre(
                            new MilliMetre_Unit(Convert.ToDouble(mc[3].Value) * ConversionConstant.MM_PER_PT)
                            , new MilliMetre_Unit(0)
                            , new MilliMetre_Unit(0)
                            , new MilliMetre_Unit(Convert.ToDouble(mc[2].Value) * ConversionConstant.MM_PER_PT)
                            );
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriteErrorLog(ex.ToString());
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }
                if (fs != null)
                {
                    fs.Close();
                }
            }
            return(trimBox);
        }
コード例 #2
0
ファイル: Acrobat8.cs プロジェクト: radtek/SLBZ
        private CREO_TrimBox_MilliMetre GetTrimBox(string seekString)
        {
            try
            {
                CREO_TrimBox_MilliMetre trimBox = new CREO_TrimBox_MilliMetre
                                                      (new MilliMetre_Unit(0), new MilliMetre_Unit(0), new MilliMetre_Unit(0), new MilliMetre_Unit(0));

                Regex           regex  = new Regex(@"(-?\d+\.?\d*)");
                MatchCollection matchs = regex.Matches(seekString);
                double          x1     = Math.Round(Convert.ToDouble(matchs[0].Value) * ConversionConstant.MM_PER_PT, 4);
                double          y1     = Math.Round(Convert.ToDouble(matchs[1].Value) * ConversionConstant.MM_PER_PT, 4);
                double          x2     = Math.Round(Convert.ToDouble(matchs[2].Value) * ConversionConstant.MM_PER_PT, 4);
                double          y2     = Math.Round(Convert.ToDouble(matchs[3].Value) * ConversionConstant.MM_PER_PT, 4);
                trimBox = new CREO_TrimBox_MilliMetre
                              (new MilliMetre_Unit(y2), new MilliMetre_Unit(y1), new MilliMetre_Unit(x1), new MilliMetre_Unit(x2));
                return(trimBox);
            }
            catch
            {
                return(null);
            }
        }
コード例 #3
0
ファイル: Default.aspx.cs プロジェクト: radtek/SLBZ
    private void ShowProcess(bool isShowGdh)
    {
        //  //出版的Excel文件
        DataTable dt_gdh_cpmc = new DataTable();

        if (isShowGdh)
        {
            CheckBoxGdh.Checked = true;
        }
        if (CheckBoxGdh.Checked)
        {
            // PublishJobTable.GetAllPublishedJobTableByHour();
            PublishJobTable.GetPublishedJobTable_All();

            //***读取稿袋号和产品名称
            dt_gdh_cpmc = MySqlDbHelper.ExecuteDataTable(
                "SELECT * FROM `Job` order by `Excel时间`desc limit 1000");
        }

        //****历史记录****
        //加载指定小时以内的完成出版的记录
        int hour = 2;
        List <EvoProcessInfo> hisProcessList = new List <EvoProcessInfo>();

        foreach (String fileFullName in EvoProcess.Get_historical_data_Files_hours(hour))
        {
            EvoProcessInfo process = new EvoProcessInfo(fileFullName);
            if (process != null)
            {
                //判断GUID是否已经存在,并确定整个的完成时间
                bool cunzai = false;
                int  index  = -1;
                for (int i = 0; i < hisProcessList.Count; i++)
                {
                    if (process.Guid == hisProcessList[i].Guid)
                    {
                        cunzai = true;
                        index  = i;
                        break;
                    }
                }

                if (cunzai)
                {
                    if (hisProcessList[index].CompletionTime.CompareTo(process.CompletionTime) < 0)
                    {
                        hisProcessList[index].CompletionTime = process.CompletionTime;
                    }
                }
                else
                {
                    hisProcessList.Add(process);
                }
            }
        }
        //************

        if (hisProcessList != null && hisProcessList.Count > 0)
        {
            //需要绑定到GridView中的DataTable
            DataTable gridVies_dt = new DataTable();
            gridVies_dt.Columns.Add("文件名");
            gridVies_dt.Columns.Add("板材咬口");
            gridVies_dt.Columns.Add("颜色");
            gridVies_dt.Columns.Add("加网信息");


            //按照完成时间排序(晚的时间靠前)
            hisProcessList.Sort(CompareProcessByCompletionTime);


            //遍历整个整理好的列表,并且将数据添加到表格中
            foreach (EvoProcessInfo proInfo in hisProcessList)
            {
                DataRow       dr = gridVies_dt.NewRow();
                StringBuilder sb = new StringBuilder();
                foreach (String fileName in proInfo.FileList)
                {
                    //稿袋号
                    int    num       = 0;
                    string gaodaihao = "";
                    if (isShowGdh)
                    {
                        foreach (DataRow row in dt_gdh_cpmc.Rows)
                        {
                            if (IsEachContain(Path.GetFileNameWithoutExtension(fileName), row["产品名称"].ToString()) &&
                                DateTime.Parse(row["Excel时间"].ToString()).AddDays(3) > DateTime.Now)
                            {
                                if (!gaodaihao.Equals(row["稿袋号"].ToString(), StringComparison.OrdinalIgnoreCase))
                                {
                                    num++;
                                    gaodaihao = row["稿袋号"].ToString();
                                }
                                if (num >= 2)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    sb.AppendLine(Path.GetFileNameWithoutExtension(fileName) + "</br>");
                    if (num == 1 && !string.IsNullOrWhiteSpace(gaodaihao))
                    {
                        sb.AppendLine("(" + gaodaihao + ")</br>");
                    }
                }
                dr["文件名"] = sb.ToString();

                dr["板材咬口"] = "板材:" + proInfo.Plant + "<br/>咬口:" + proInfo.OffsetY + "<br/>";

                sb.Clear();
                foreach (String color in proInfo.ColorList)
                {
                    sb.AppendLine(color + "</br>");
                }
                dr["颜色"]   = sb.ToString();
                dr["加网信息"] = "线数:" + proInfo.RulingOrFeatureSize
                             + "</br>网点:" + proInfo.DotShape
                             + "</br>曲线:" + proInfo.CalibrationTarget;
                gridVies_dt.Rows.Add(dr);
            }
            this.GridViewHistorical.Visible    = true;
            this.GridViewHistorical.DataSource = gridVies_dt;
            this.GridViewHistorical.DataBind();
        }
        else
        {
            this.GridViewHistorical.Visible = false;
        }


        //*****当前出版记录
        //加载所有的完成出版的记录
        List <EvoProcessInfo> dynProcessList = new List <EvoProcessInfo>();

        foreach (String fileFullName in EvoProcess.Get_dynamic_data_Files_All())
        {
            EvoProcessInfo process = new EvoProcessInfo(fileFullName);
            if (process.FileList.Count > 0)
            {
                //判断GUID是否已经存在,并确定整个的完成时间
                bool cunzai = false;
                int  index  = -1;
                for (int i = 0; i < dynProcessList.Count; i++)
                {
                    if (process.Guid == dynProcessList[i].Guid)
                    {
                        cunzai = true;
                        index  = i;
                        break;
                    }
                }

                if (cunzai)
                {
                    if (dynProcessList[index].CompletionTime.CompareTo(process.CompletionTime) < 0)
                    {
                        dynProcessList[index].CompletionTime = process.CompletionTime;
                    }
                }
                else
                {
                    dynProcessList.Add(process);
                }
            }
        }

        //************

        if (dynProcessList != null && dynProcessList.Count > 0)
        {
            //需要绑定到GridView中的DataTable
            DataTable gridVies_dt = new DataTable();
            gridVies_dt.Columns.Add("文件名");
            gridVies_dt.Columns.Add("板材咬口");
            gridVies_dt.Columns.Add("颜色");
            gridVies_dt.Columns.Add("加网信息");


            //按照完成时间排序(晚的时间靠前)
            dynProcessList.Sort(CompareProcessByCompletionTime);


            //遍历整个整理好的列表,并且将数据添加到表格中
            foreach (EvoProcessInfo proInfo in dynProcessList)
            {
                DataRow       dr = gridVies_dt.NewRow();
                StringBuilder sb = new StringBuilder();
                foreach (String fileName in proInfo.FileList)
                {
                    //稿袋号
                    int    num       = 0;
                    string gaodaihao = "";
                    if (isShowGdh)
                    {
                        foreach (DataRow row in dt_gdh_cpmc.Rows)
                        {
                            if (IsEachContain(Path.GetFileNameWithoutExtension(fileName), row["产品名称"].ToString()) &&
                                DateTime.Parse(row["Excel时间"].ToString()).AddDays(3) > DateTime.Now)
                            {
                                if (!gaodaihao.Equals(row["稿袋号"].ToString(), StringComparison.OrdinalIgnoreCase))
                                {
                                    num++;
                                    gaodaihao = row["稿袋号"].ToString();
                                }
                                if (num >= 2)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    sb.Append(Path.GetFileNameWithoutExtension(fileName) + "</br>");
                    if (num == 1 && !string.IsNullOrWhiteSpace(gaodaihao))
                    {
                        sb.AppendLine("(" + gaodaihao + ")</br>");
                    }
                }
                dr["文件名"] = sb.ToString();

                dr["板材咬口"] = "板材:" + proInfo.Plant + "</br>咬口:" + proInfo.OffsetY;

                sb.Clear();
                foreach (String color in proInfo.ColorList)
                {
                    sb.AppendLine(color + "</br>");
                }
                dr["颜色"]   = sb.ToString();
                dr["加网信息"] = "线数:" + proInfo.RulingOrFeatureSize
                             + "</br>网点:" + proInfo.DotShape
                             + "</br>曲线:" + proInfo.CalibrationTarget;
                gridVies_dt.Rows.Add(dr);
            }
            this.GridViewDynamic.Visible    = true;
            this.GridViewDynamic.DataSource = gridVies_dt;
            this.GridViewDynamic.DataBind();
        }
        else
        {
            this.GridViewDynamic.Visible = false;
        }
        try
        {
            //***错误信息
            if (true)
            {
                DataTable dt_error = new DataTable();
                dt_error.Columns.Add("文件名");
                dt_error.Columns.Add("错误");
                //[ID],[Name],[PlantSize],[Bite],[MaxPaper],[MaxPrinting],[MinPaper]
                List <PrintingMachineInfo> pmList = new List <PrintingMachineInfo>();
                foreach (DataRow row in
                         MySqlDbHelper.ExecuteDataTable("SELECT*FROM`PrintingMachine`").Rows)
                {
                    pmList.Add(new PrintingMachineInfo(row));
                }
                List <EvoProcessInfo> allList = new List <EvoProcessInfo>();
                allList.AddRange(hisProcessList);
                allList.AddRange(dynProcessList);
                foreach (EvoProcessInfo pro in allList)
                {
                    PrintingMachineInfo pmInfo = pmList.Find(p => p.PlantSize_L == pro.Plant_L && p.PlantSize_S == pro.Plant_S);
                    if (pmInfo == null)
                    {
                        continue;
                    }
                    foreach (string fileName in pro.FileList)
                    {
                        StringBuilder sb = new StringBuilder();
                        //***咬口错误
                        if (pro.OffsetY > pmInfo.Bite || pro.OffsetY < 10 ||
                            pro.OffsetY < pmInfo.Bite - 30)
                        {
                            sb.Append("咬口错误<br />");
                        }
                        //***最大过纸
                        //***最大印刷尺寸
                        if (sb.Length == 0)
                        {
                            if (pro.ImagingPosition != null)
                            {
                                CREO_TrimBox_MilliMetre imaging = pro.ImagingPosition.GetCREO_TrimBox_MilliMetre();
                                if (pmInfo.MaxPrinting_S + pmInfo.Bite < imaging.High.Length + pro.OffsetY - 10 ||
                                    imaging.Left.Length < 0)
                                {
                                    sb.Append("超出最大印刷面积<br />");
                                }
                            }
                        }

                        //***最小过纸
                        //***重复提交
                        if (sb.Length == 0)
                        {
                            bool isRepeat = false;
                            foreach (EvoProcessInfo pro_child in allList)
                            {
                                if (pro == pro_child)
                                {
                                    continue;
                                }
                                if (pro_child.Equals(pro))
                                {
                                    isRepeat = true;
                                    break;
                                }
                            }
                            if (isRepeat)
                            {
                                sb.Append("重复提交<br />");
                            }
                        }
                        //***汇总信息
                        if (sb.Length > 0)
                        {
                            DataRow row = dt_error.NewRow();
                            row["文件名"] = Path.GetFileNameWithoutExtension(fileName);
                            row["错误"]  = sb.ToString();
                            dt_error.Rows.Add(row);
                        }
                    }
                }
                if (dt_error.Rows.Count > 0)
                {
                    this.GridViewError.Visible    = true;
                    this.LableError.Visible       = true;
                    this.GridViewError.DataSource = dt_error;
                    this.GridViewError.DataBind();
                }
                else
                {
                    this.GridViewError.Visible = false;
                    this.LableError.Visible    = false;
                }
            }
            //else
            //{
            //    this.GridViewError.Visible = false;
            //    this.LableError.Visible = false;
            //}
        }
        catch
        {
        }
    }
コード例 #4
0
ファイル: Acrobat8.cs プロジェクト: radtek/SLBZ
        /// <summary>
        /// 返回'CREO_TrimBox ',如果文件没有做版心则返回'MediaBox'的尺寸
        /// 如果读取过程出错则返回null.
        /// </summary>
        /// <returns></returns>
        public CREO_TrimBox_MilliMetre GetCREO_TrimBox()
        {
            FileStream              fs      = null;
            StreamReader            sr      = null;
            CREO_TrimBox_MilliMetre trimBox = new CREO_TrimBox_MilliMetre
                                                  (new MilliMetre_Unit(0), new MilliMetre_Unit(0), new MilliMetre_Unit(0), new MilliMetre_Unit(0));

            try
            {
                FileInfo fileInfo = this.AcrobatFileInfo;
                //确定trimBox
                fs = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                //确定查找位置
                Int32 readLength = 3 * 1024 * 1024;//读取3072KB(3MB)
                if (fs.Length > readLength)
                {
                    fs.Seek(-readLength, SeekOrigin.End);
                }

                sr = new StreamReader(fs);

                string          seekString = sr.ReadToEnd();
                Regex           regex      = new Regex(@"CREO_TrimBox\[(-?\d+\.?\d*) (-?\d+\.?\d*) (\d+\.?\d*) (\d+\.?\d*)\]");
                MatchCollection matchs     = regex.Matches(seekString);
                //找到版心的最后一组数据
                if (matchs.Count > 0)
                {
                    seekString = matchs[matchs.Count - 1].ToString();
                    trimBox    = GetTrimBox(seekString);
                    if (trimBox != null)
                    {
                        trimBox.TrimBox_Type = PdfSizeBox.CREO_TrimBox;
                    }
                }
                else
                {
                    char[] chars = new char[readLength];
                    fs.Seek(0, SeekOrigin.Begin);
                    sr = new StreamReader(fs);
                    sr.Read(chars, 0, readLength);
                    //sr.ReadBlock(chars, 0, readLength);
                    seekString = new string(chars);
                    regex      = new Regex(@"CREO_TrimBox\[(-?\d+\.?\d*) (-?\d+\.?\d*) (\d+\.?\d*) (\d+\.?\d*)\]");
                    seekString = regex.Match(seekString).Value;
                    trimBox    = GetTrimBox(seekString);
                    if (trimBox != null)
                    {
                        trimBox.TrimBox_Type = PdfSizeBox.CREO_TrimBox;
                    }
                }
                if (trimBox == null ||
                    trimBox.Width.Length == 0 ||
                    trimBox.High.Length == 0)
                {
                    char[] chars = new char[readLength];
                    fs.Seek(0, SeekOrigin.Begin);
                    sr = new StreamReader(fs);
                    sr.ReadBlock(chars, 0, readLength);
                    seekString = new string(chars);
                    regex      = new Regex(@"MediaBox\[(-?\d+\.?\d*) (-?\d+\.?\d*) (\d+\.?\d*) (\d+\.?\d*)\]");
                    seekString = regex.Match(seekString).Value;
                    trimBox    = GetTrimBox(seekString);
                    if (trimBox != null)
                    {
                        trimBox.TrimBox_Type = PdfSizeBox.MediaBox;
                    }
                    if (trimBox.Width.Length == 0 ||
                        trimBox.High.Length == 0)
                    {
                        trimBox = null;
                    }
                }
            }
            catch
            {
                // Log.WriteLog(ex.ToString());
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }
                if (fs != null)
                {
                    fs.Close();
                }
            }
            return(trimBox);
        }