Beispiel #1
0
        public bool CCFileUpdate(CC_File model)
        {
            model.UpdateTime = DateTime.Now;

            if (fileInstance.Update(model) > 0)
            {
                return true;
            }

            return false;
        }
Beispiel #2
0
        public bool CCFileInsert(CC_File model)
        {
            model.CreateTime = DateTime.Now;

            model.UpdateTime = DateTime.Now;

            if (fileInstance.Add(model) > 0)
            {
                return true;
            }

            return false;
        }
Beispiel #3
0
 public List<CC_File> GetListByWhereExtend(string strCondition)
 {
     List<CC_File> ret = new List<CC_File>();
     string sql = "SELECT  CCF_ID,CCF_Code,CCF_DCode,CCF_CompNo,CCF_Name,CCF_iType,CCF_Directory,CCF_Bak,CCF_DownTime,CCF_RCount,CCF_RDirectory,CCF_ROwner,CCF_RDate,CCF_RBak,cc.Stat,cc.Creator,cc.CreateTime,cc.UpdateTime,cc.DeleteTime FROM CC_File cc JOIN Prod_Doc pp on pp.PRDQ_Code=CCF_DCode WHERE 1=1 AND ((cc.Stat is null) or (cc.Stat=0) ) ";
     if (!string.IsNullOrEmpty(strCondition))
     {
         strCondition.Replace('\'', '"'); //防sql注入
         sql += strCondition;
     }
     SqlDataReader dr = null;
     try
     {
         dr = (SqlDataReader)idb.ReturnReader(sql);
         while (dr.Read())
         {
             CC_File cC_File = new CC_File();
             if (dr["CCF_ID"] != DBNull.Value) cC_File.CCF_ID = Convert.ToDecimal(dr["CCF_ID"]);
             if (dr["CCF_Code"] != DBNull.Value) cC_File.CCF_Code = Convert.ToString(dr["CCF_Code"]);
             if (dr["CCF_DCode"] != DBNull.Value) cC_File.CCF_DCode = Convert.ToString(dr["CCF_DCode"]);
             if (dr["CCF_CompNo"] != DBNull.Value) cC_File.CCF_CompNo = Convert.ToString(dr["CCF_CompNo"]);
             if (dr["CCF_Name"] != DBNull.Value) cC_File.CCF_Name = Convert.ToString(dr["CCF_Name"]);
             if (dr["CCF_iType"] != DBNull.Value) cC_File.CCF_iType = Convert.ToString(dr["CCF_iType"]);
             if (dr["CCF_Directory"] != DBNull.Value) cC_File.CCF_Directory = Convert.ToString(dr["CCF_Directory"]);
             if (dr["CCF_Bak"] != DBNull.Value) cC_File.CCF_Bak = Convert.ToString(dr["CCF_Bak"]);
             if (dr["CCF_DownTime"] != DBNull.Value) cC_File.CCF_DownTime = Convert.ToString(dr["CCF_DownTime"]);
             if (dr["CCF_RCount"] != DBNull.Value) cC_File.CCF_RCount = Convert.ToInt32(dr["CCF_RCount"]);
             if (dr["CCF_RDirectory"] != DBNull.Value) cC_File.CCF_RDirectory = Convert.ToString(dr["CCF_RDirectory"]);
             if (dr["CCF_ROwner"] != DBNull.Value) cC_File.CCF_ROwner = Convert.ToString(dr["CCF_ROwner"]);
             if (dr["CCF_RDate"] != DBNull.Value) cC_File.CCF_RDate = Convert.ToDateTime(dr["CCF_RDate"]);
             if (dr["CCF_RBak"] != DBNull.Value) cC_File.CCF_RBak = Convert.ToString(dr["CCF_RBak"]);
             if (dr["Stat"] != DBNull.Value) cC_File.Stat = Convert.ToInt32(dr["Stat"]);
             if (dr["Creator"] != DBNull.Value) cC_File.Creator = Convert.ToDateTime(dr["Creator"]);
             if (dr["CreateTime"] != DBNull.Value) cC_File.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
             if (dr["UpdateTime"] != DBNull.Value) cC_File.UpdateTime = Convert.ToDateTime(dr["UpdateTime"]);
             if (dr["DeleteTime"] != DBNull.Value) cC_File.DeleteTime = Convert.ToDateTime(dr["DeleteTime"]);
             ret.Add(cC_File);
         }
     }
     catch (System.Exception ex) { throw ex; }
     finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); } }
     return ret;
 }
Beispiel #4
0
        /// <summary>
        /// 文档删除
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public bool DeleteDocument(CC_File file)
        {
            file.Stat = 1;
            if (fileInstance.Update(file) > 0)
            {
                return true;
            }

            return false;
        }
Beispiel #5
0
 public bool AddCCFile(CC_File model)
 {
     model.CreateTime = DateTime.Now;
     model.UpdateTime = DateTime.Now;
     return CCFileInsert(model);
 }
Beispiel #6
0
        /// <summary>
        /// 更新CC_File对象(即:一条记录
        /// </summary>
        public int Update(CC_File cC_File)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       CC_File       SET ");
            if(cC_File.CCF_Code_IsChanged){sbParameter.Append("CCF_Code=@CCF_Code, ");}
              if(cC_File.CCF_DCode_IsChanged){sbParameter.Append("CCF_DCode=@CCF_DCode, ");}
              if(cC_File.CCF_CompNo_IsChanged){sbParameter.Append("CCF_CompNo=@CCF_CompNo, ");}
              if(cC_File.CCF_Name_IsChanged){sbParameter.Append("CCF_Name=@CCF_Name, ");}
              if(cC_File.CCF_iType_IsChanged){sbParameter.Append("CCF_iType=@CCF_iType, ");}
              if(cC_File.CCF_Directory_IsChanged){sbParameter.Append("CCF_Directory=@CCF_Directory, ");}
              if(cC_File.CCF_Bak_IsChanged){sbParameter.Append("CCF_Bak=@CCF_Bak, ");}
              if(cC_File.CCF_DownTime_IsChanged){sbParameter.Append("CCF_DownTime=@CCF_DownTime, ");}
              if(cC_File.CCF_RCount_IsChanged){sbParameter.Append("CCF_RCount=@CCF_RCount, ");}
              if(cC_File.CCF_RDirectory_IsChanged){sbParameter.Append("CCF_RDirectory=@CCF_RDirectory, ");}
              if(cC_File.CCF_ROwner_IsChanged){sbParameter.Append("CCF_ROwner=@CCF_ROwner, ");}
              if(cC_File.CCF_RDate_IsChanged){sbParameter.Append("CCF_RDate=@CCF_RDate, ");}
              if(cC_File.CCF_RBak_IsChanged){sbParameter.Append("CCF_RBak=@CCF_RBak, ");}
              if(cC_File.Stat_IsChanged){sbParameter.Append("Stat=@Stat, ");}
              if(cC_File.Creator_IsChanged){sbParameter.Append("Creator=@Creator, ");}
              if(cC_File.CreateTime_IsChanged){sbParameter.Append("CreateTime=@CreateTime, ");}
              if(cC_File.UpdateTime_IsChanged){sbParameter.Append("UpdateTime=@UpdateTime, ");}
              if(cC_File.DeleteTime_IsChanged){sbParameter.Append("DeleteTime=@DeleteTime ");}
          sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and CCF_ID=@CCF_ID; " );
              string sql=sb.ToString();
             if(cC_File.CCF_Code_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_Code))
             {
            idb.AddParameter("@CCF_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_Code", cC_File.CCF_Code);
             }
              }
             if(cC_File.CCF_DCode_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_DCode))
             {
            idb.AddParameter("@CCF_DCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_DCode", cC_File.CCF_DCode);
             }
              }
             if(cC_File.CCF_CompNo_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_CompNo))
             {
            idb.AddParameter("@CCF_CompNo", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_CompNo", cC_File.CCF_CompNo);
             }
              }
             if(cC_File.CCF_Name_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_Name))
             {
            idb.AddParameter("@CCF_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_Name", cC_File.CCF_Name);
             }
              }
             if(cC_File.CCF_iType_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_iType))
             {
            idb.AddParameter("@CCF_iType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_iType", cC_File.CCF_iType);
             }
              }
             if(cC_File.CCF_Directory_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_Directory))
             {
            idb.AddParameter("@CCF_Directory", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_Directory", cC_File.CCF_Directory);
             }
              }
             if(cC_File.CCF_Bak_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_Bak))
             {
            idb.AddParameter("@CCF_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_Bak", cC_File.CCF_Bak);
             }
              }
             if(cC_File.CCF_DownTime_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_DownTime))
             {
            idb.AddParameter("@CCF_DownTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_DownTime", cC_File.CCF_DownTime);
             }
              }
             if(cC_File.CCF_RCount_IsChanged)
             {
             if (cC_File.CCF_RCount == 0)
             {
            idb.AddParameter("@CCF_RCount", 0);
             }
             else
             {
            idb.AddParameter("@CCF_RCount", cC_File.CCF_RCount);
             }
              }
             if(cC_File.CCF_RDirectory_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_RDirectory))
             {
            idb.AddParameter("@CCF_RDirectory", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_RDirectory", cC_File.CCF_RDirectory);
             }
              }
             if(cC_File.CCF_ROwner_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_ROwner))
             {
            idb.AddParameter("@CCF_ROwner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_ROwner", cC_File.CCF_ROwner);
             }
              }
             if(cC_File.CCF_RDate_IsChanged)
             {
             if (cC_File.CCF_RDate == DateTime.MinValue)
             {
            idb.AddParameter("@CCF_RDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_RDate", cC_File.CCF_RDate);
             }
              }
             if(cC_File.CCF_RBak_IsChanged)
             {
             if (string.IsNullOrEmpty(cC_File.CCF_RBak))
             {
            idb.AddParameter("@CCF_RBak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_RBak", cC_File.CCF_RBak);
             }
              }
             if(cC_File.Stat_IsChanged)
             {
             if (cC_File.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", cC_File.Stat);
             }
              }
             if(cC_File.Creator_IsChanged)
             {
             if (cC_File.Creator == DateTime.MinValue)
             {
            idb.AddParameter("@Creator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Creator", cC_File.Creator);
             }
              }
             if(cC_File.CreateTime_IsChanged)
             {
             if (cC_File.CreateTime == DateTime.MinValue)
             {
            idb.AddParameter("@CreateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CreateTime", cC_File.CreateTime);
             }
              }
             if(cC_File.UpdateTime_IsChanged)
             {
             if (cC_File.UpdateTime == DateTime.MinValue)
             {
            idb.AddParameter("@UpdateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@UpdateTime", cC_File.UpdateTime);
             }
              }
             if(cC_File.DeleteTime_IsChanged)
             {
             if (cC_File.DeleteTime == DateTime.MinValue)
             {
            idb.AddParameter("@DeleteTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DeleteTime", cC_File.DeleteTime);
             }
              }

             idb.AddParameter("@CCF_ID", cC_File.CCF_ID);

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
            }            return Re;
Beispiel #7
0
 public bool UpdateCCFile(CC_File model)
 {
     //model.CreateTime = DateTime.Now;
     model.UpdateTime = DateTime.Now;
     return CCFileUpdate(model);
 }
Beispiel #8
0
        /// <summary>
        /// 添加CC_File对象(即:一条记录)
        /// </summary>
        public int Add(CC_File cC_File)
        {
            string sql = "INSERT INTO CC_File (CCF_Code,CCF_DCode,CCF_CompNo,CCF_Name,CCF_iType,CCF_Directory,CCF_Bak,CCF_DownTime,CCF_RCount,CCF_RDirectory,CCF_ROwner,CCF_RDate,CCF_RBak,Stat,Creator,CreateTime,UpdateTime,DeleteTime) VALUES (@CCF_Code,@CCF_DCode,@CCF_CompNo,@CCF_Name,@CCF_iType,@CCF_Directory,@CCF_Bak,@CCF_DownTime,@CCF_RCount,@CCF_RDirectory,@CCF_ROwner,@CCF_RDate,@CCF_RBak,@Stat,@Creator,@CreateTime,@UpdateTime,@DeleteTime)";
             if (string.IsNullOrEmpty(cC_File.CCF_Code))
             {
            idb.AddParameter("@CCF_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_Code", cC_File.CCF_Code);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_DCode))
             {
            idb.AddParameter("@CCF_DCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_DCode", cC_File.CCF_DCode);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_CompNo))
             {
            idb.AddParameter("@CCF_CompNo", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_CompNo", cC_File.CCF_CompNo);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_Name))
             {
            idb.AddParameter("@CCF_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_Name", cC_File.CCF_Name);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_iType))
             {
            idb.AddParameter("@CCF_iType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_iType", cC_File.CCF_iType);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_Directory))
             {
            idb.AddParameter("@CCF_Directory", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_Directory", cC_File.CCF_Directory);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_Bak))
             {
            idb.AddParameter("@CCF_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_Bak", cC_File.CCF_Bak);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_DownTime))
             {
            idb.AddParameter("@CCF_DownTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_DownTime", cC_File.CCF_DownTime);
             }
             if (cC_File.CCF_RCount == 0)
             {
            idb.AddParameter("@CCF_RCount", 0);
             }
             else
             {
            idb.AddParameter("@CCF_RCount", cC_File.CCF_RCount);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_RDirectory))
             {
            idb.AddParameter("@CCF_RDirectory", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_RDirectory", cC_File.CCF_RDirectory);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_ROwner))
             {
            idb.AddParameter("@CCF_ROwner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_ROwner", cC_File.CCF_ROwner);
             }
             if (cC_File.CCF_RDate == DateTime.MinValue)
             {
            idb.AddParameter("@CCF_RDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_RDate", cC_File.CCF_RDate);
             }
             if (string.IsNullOrEmpty(cC_File.CCF_RBak))
             {
            idb.AddParameter("@CCF_RBak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CCF_RBak", cC_File.CCF_RBak);
             }
             if (cC_File.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", cC_File.Stat);
             }
             if (cC_File.Creator == DateTime.MinValue)
             {
            idb.AddParameter("@Creator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Creator", cC_File.Creator);
             }
             if (cC_File.CreateTime == DateTime.MinValue)
             {
            idb.AddParameter("@CreateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CreateTime", cC_File.CreateTime);
             }
             if (cC_File.UpdateTime == DateTime.MinValue)
             {
            idb.AddParameter("@UpdateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@UpdateTime", cC_File.UpdateTime);
             }
             if (cC_File.DeleteTime == DateTime.MinValue)
             {
            idb.AddParameter("@DeleteTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DeleteTime", cC_File.DeleteTime);
             }

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
             }            return Re;
        }
Beispiel #9
0
        /// <summary>
        /// 获取指定的CC_File对象(即:一条记录
        /// </summary>
        public CC_File GetByKey(decimal cCF_ID)
        {
            CC_File cC_File = new CC_File();
             string sql = "SELECT  CCF_ID,CCF_Code,CCF_DCode,CCF_CompNo,CCF_Name,CCF_iType,CCF_Directory,CCF_Bak,CCF_DownTime,CCF_RCount,CCF_RDirectory,CCF_ROwner,CCF_RDate,CCF_RBak,Stat,Creator,CreateTime,UpdateTime,DeleteTime FROM CC_File WHERE 1=1 AND ((Stat is null) or (Stat=0) )  AND CCF_ID=@CCF_ID ";
             idb.AddParameter("@CCF_ID", cCF_ID);

              SqlDataReader dr=null;
               try {
              dr=(SqlDataReader)idb.ReturnReader(sql);
             while(dr.Read())
             {
            if (dr["CCF_ID"] != DBNull.Value) cC_File.CCF_ID = Convert.ToDecimal(dr["CCF_ID"]);
            if (dr["CCF_Code"] != DBNull.Value) cC_File.CCF_Code = Convert.ToString(dr["CCF_Code"]);
            if (dr["CCF_DCode"] != DBNull.Value) cC_File.CCF_DCode = Convert.ToString(dr["CCF_DCode"]);
            if (dr["CCF_CompNo"] != DBNull.Value) cC_File.CCF_CompNo = Convert.ToString(dr["CCF_CompNo"]);
            if (dr["CCF_Name"] != DBNull.Value) cC_File.CCF_Name = Convert.ToString(dr["CCF_Name"]);
            if (dr["CCF_iType"] != DBNull.Value) cC_File.CCF_iType = Convert.ToString(dr["CCF_iType"]);
            if (dr["CCF_Directory"] != DBNull.Value) cC_File.CCF_Directory = Convert.ToString(dr["CCF_Directory"]);
            if (dr["CCF_Bak"] != DBNull.Value) cC_File.CCF_Bak = Convert.ToString(dr["CCF_Bak"]);
            if (dr["CCF_DownTime"] != DBNull.Value) cC_File.CCF_DownTime = Convert.ToString(dr["CCF_DownTime"]);
            if (dr["CCF_RCount"] != DBNull.Value) cC_File.CCF_RCount = Convert.ToInt32(dr["CCF_RCount"]);
            if (dr["CCF_RDirectory"] != DBNull.Value) cC_File.CCF_RDirectory = Convert.ToString(dr["CCF_RDirectory"]);
            if (dr["CCF_ROwner"] != DBNull.Value) cC_File.CCF_ROwner = Convert.ToString(dr["CCF_ROwner"]);
            if (dr["CCF_RDate"] != DBNull.Value) cC_File.CCF_RDate = Convert.ToDateTime(dr["CCF_RDate"]);
            if (dr["CCF_RBak"] != DBNull.Value) cC_File.CCF_RBak = Convert.ToString(dr["CCF_RBak"]);
            if (dr["Stat"] != DBNull.Value) cC_File.Stat = Convert.ToInt32(dr["Stat"]);
            if (dr["Creator"] != DBNull.Value) cC_File.Creator = Convert.ToDateTime(dr["Creator"]);
            if (dr["CreateTime"] != DBNull.Value) cC_File.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
            if (dr["UpdateTime"] != DBNull.Value) cC_File.UpdateTime = Convert.ToDateTime(dr["UpdateTime"]);
            if (dr["DeleteTime"] != DBNull.Value) cC_File.DeleteTime = Convert.ToDateTime(dr["DeleteTime"]);
             }
              }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
             return cC_File;
        }
Beispiel #10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="cc">当前文档</param>
        public void SaveRefPath(CC_File cc)
        {
            Bll_File fileInstance = new Bll_File();
            //如果存在该文档
            if (RefCompList.Keys.Contains(cc.CCF_DCode))
            {
                var compList = RefCompList[cc.CCF_DCode];

                foreach (var comp in compList)
                {
                    string lastpath = GlabolConfiguration.SeverPath + "\\" + comp.PRDC_CompNo;
                    if (!Directory.Exists(lastpath))
                    {
                        try
                        {
                            Directory.CreateDirectory(lastpath);
                        }
                        catch (Exception ex)
                        {
                            //写入数据库日志
                            PlateLog.WriteError(SessionConfig.UserID, SessionConfig.UserName,
                                "", "CompManage 多零件同步",
                               ex.Message, PlateLog.LogMessageType.Error, ex);
                        }
                    }
                    //fileInstance.ftp.GotoDirectory(".");

                    //if (!fileInstance.ftp.DirectoryExist(comp.PRDC_CompNo))
                    //{
                    //    fileInstance.ftp.MakeDirectory(comp.PRDC_CompNo);
                    //}

                    //fileInstance.ftp.GotoDirectory("." + Path.GetDirectoryName(cc.CCF_Directory));

                    //var flag = fileInstance.ftp.CopyFileToAnotherDirectoryOverWrite(Path.GetFileName(cc.CCF_Directory), "./" + comp.PRDC_CompNo);

                    File.Copy(GlabolConfiguration.SeverPath + cc.CCF_Directory.Replace('/', '\\'), lastpath + "\\" + cc.CCF_Name + ".pdf");

                }
            }
        }
Beispiel #11
0
        public void StartScan(string filename, string dcode)
        {
            //ScanHelperXP scan = new ScanHelperXP();
            CC_File file;
            PDFHelper pdf = new PDFHelper();

            bool flag = true;

            var list = new List<Image>();
            try
            {
                if (comboStat.SelectedValue != null && comboStat.SelectedValue.ToString() == "Duplex")
                {
                    list = scan.StartScan(1);
                }
                else
                {
                    list = scan.StartScan();
                }

                //Image img = Image.FromFile("D:\\test.png");
                //list.Add(img);
                //Image img2 = Image.FromFile("D:\\2.bmp");
                //list.Add(img2);
                //Image img3 = Image.FromFile("D:\\2.bmp");
                //list.Add(img3);
                //Image img4 = Image.FromFile("D:\\2.bmp");
                //list.Add(img4);
                //Image img5 = Image.FromFile("D:\\2.bmp");
                //list.Add(img5);

            }
            catch (Exception ex)
            {
                //如果发生异常则之后则后面则不再提示信息
                flag = false;
                Alert.Show(ex.Message);
            }

            if (list != null && list.Count != 0)
            {
                var templist = list.ToList();

                string path = LocalPath + "\\" + filename + ".pdf";

                MethodInvoker mi = delegate
                {
                    try
                    {
                        pdf.MakePDF(path, templist);
                    }
                    catch (Exception ex)
                    {
                        //Alert.Show("生成文档失败");
                    }
                    //Alert.Show("文档生成成功!");

                    file = new CC_File();
                    file.CCF_DCode = dcode;
                    file.CCF_Name = filename;
                    file.CCF_Directory = path;

                    list = null;

                    CCFileList.Add(file);

                    SaveDictionary();

                    SavePath();

                    Alert.Show("文档生成成功!");
                };

                mi.BeginInvoke(null, null);

            }
            else
            {
                if (flag)
                {
                    Alert.Show("未找到可扫描文件请确认扫描仪是否可用!");
                }

            }
        }
Beispiel #12
0
        /// <summary>
        /// 零件文档扫描
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void scanBtn_Click(object sender, EventArgs e)
        {
            UltraGridRow row = this.comGrid.ActiveRow;
            if (row == null)
            {
                return;
            }
            Prod_Doc doc = row.ListObject as Prod_Doc;

            if (string.IsNullOrEmpty(doc.PRDQ_Code))
            {
                Alert.Show("请先填写报告编号!");
                return;
            }

            if (doc.PRDQ_IsScan == 1 && !row.IsAddRow)
            {
                ConfirmWin confirmWin = new ConfirmWin();
                confirmWin.ShowDialog();
                if (!confirmWin.IsAllow)
                {
                    Alert.Show("当前文档已扫描,不能进行重复扫描覆盖操作!");
                    return;
                }
            }

            string dcode = doc.PRDQ_Code;
            string compNo = string.Empty;
            if (compNoEditor != null)
            {
                compNo = compNoEditor.Text;
            }
            string filename = compNo + "_" + dcode + "_" + DateTime.Now.ToString("yyyy-MM-dd");
            CC_File file = new CC_File();
            try
            {
                //file =StartScan(filename, dcode);
                StartScan(filename, dcode);
                row.Appearance.BackColor = Color.Wheat;
                doc.PRDQ_IsScan = 1;
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }

            //if (file != null)
            //{
            //    //if (doc.PRDQ_ID != 0)
            //    //{
            //    //    file.Stat = 0;
            //    //}
            //    //CCFileList.Add(file);

            //}
        }
Beispiel #13
0
        /// <summary>
        /// 零件文档扫描
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void scanBtn_Click(object sender, EventArgs e)
        {
            UltraGridRow row = this.prodDocGrid.ActiveRow;
            if (row == null)
            {
                return;
            }
            Prod_Doc doc = row.ListObject as Prod_Doc;

            if (string.IsNullOrEmpty(doc.PRDQ_Code))
            {
                Alert.Show("请先填写报告编号!");
                return;
            }

            if (doc.PRDQ_IsScan == 1)
            {
                ConfirmWin confirmWin = new ConfirmWin();
                confirmWin.ShowDialog();
                if (!confirmWin.IsAllow)
                {
                    Alert.Show("当前文档已扫描,不能进行重复扫描覆盖操作!");
                    return;
                }
            }

            string dcode = doc.PRDQ_Code;

            //string filename = GModel.PRM_Code + "_" + dcode + "_" + DateTime.Now.ToString("yyyy-MM-dd");

            //var file = StartScan(filename, dcode);

            //if (file != null)
            //{
            //    if (doc.PRDQ_ID != 0)
            //    {
            //        file.Stat = 1;
            //    }
            //    CCFileList.Add(file);

            //    Alert.Show("扫描完成!");

            //    row.Appearance.BackColor = Color.Wheat;
            //    doc.PRDQ_IsScan = 1;
            //}

            var com = bmHelper.FindCtl<UltraTextEditor>(this.pnlGrid.Controls, "PRM_Code");
            string prodcode = com.Text;
            if (string.IsNullOrEmpty(prodcode))
            {
                Alert.Show("请输入编号!");
                return;
            }
            string filename = prodcode + "_" + dcode + "_" + DateTime.Now.ToString("yyyy-MM-dd");
            CC_File file = new CC_File();
            try
            {
                StartScan(filename, dcode);
                row.Appearance.BackColor = Color.Wheat;
                doc.PRDQ_IsScan = 1;
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
        }
Beispiel #14
0
        //public CC_File StartScan(string filename, string dcode)
        //{
        //    ScanHelper scan = new ScanHelper();
        //    CC_File file;
        //    PDFHelper pdf = new PDFHelper();
        //    var list = scan.StartScan();
        //    if (list != null && list.Count != 0)
        //    {
        //        pdf.MakePDF(LocalPath + filename + ".pdf", list);
        //        file = new CC_File();
        //        file.CCF_DCode = dcode;
        //        file.CCF_Name = filename;
        //        file.CCF_iType = "Prod";
        //        file.CCF_Directory = LocalPath + filename + ".pdf";
        //        return file;
        //    }
        //    else
        //    {
        //        Alert.Show("请确认是否已把扫描文档放到Feeder");
        //        return null;
        //    }
        //}
        public void StartScan(string filename, string dcode)
        {
            bool flag = true;
            CC_File file;
            PDFHelper pdf = new PDFHelper();
            List<Image> list = new List<Image>();
            try
            {
                list = scan.StartScan();
            }
            catch (Exception ex)
            {
                flag = false;
                Alert.Show(ex.Message);
            }

            if (list != null && list.Count != 0)
            {

                var templist = list.ToList();
                string path = LocalPath + "\\" + filename + ".pdf";
                MethodInvoker mi = delegate
                {
                    try
                    {
                        pdf.MakePDF(path, templist);
                    }
                    catch
                    { }

                    //AutoClosedMessageBox.Show(" 文档生成成功!", " 提示", 15, 2000);
                    file = new CC_File();
                    file.CCF_DCode = dcode;
                    file.CCF_Name = filename;
                    file.CCF_iType = "ProdRepair";
                    file.CCF_Directory = path;

                    list = null;
                    CCFileList.Add(file);
                    SavePath();

                    Alert.Show("文档生成成功!");
                };

                mi.BeginInvoke(null, null);

                //GC.Collect();

                //return file;

            }
            else
            {
                if (flag)
                {
                    Alert.Show("请确认是否已把扫描文档放到Feeder");
                }
                //return null;
            }
        }
Beispiel #15
0
        void scanRepairBtn_Click(object sender, EventArgs e)
        {
            UltraGridRow row = this.repairGrid.ActiveRow;
            if (row == null)
            {
                return;
            }
            Prod_Maintain doc = row.ListObject as Prod_Maintain;

            if (string.IsNullOrEmpty(doc.PRM_Code))
            {
                Alert.Show("请先填写报告编号!");
                return;
            }

            string dcode = doc.PRM_Code;
            var com = bmHelper.FindCtl<UltraTextEditor>(this.gpBse.Controls, "PRP_ProdCode");
            string prodcode = string.Empty;
            if (com != null)
            {
                prodcode = com.Text;
            }

            if (string.IsNullOrEmpty(prodcode))
            {
                Alert.Show("请先输入成品编号!");
                return;
            }

            string filename = prodcode + "_" + dcode + "_" + DateTime.Now.ToString("yyyy-MM-dd");
            CC_File file = new CC_File();
            try
            {
                StartScan(filename, dcode);
                row.Appearance.BackColor = Color.Wheat;

            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
        }
Beispiel #16
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="cc">当前文档</param>
        public void SaveRefPath(CC_File cc)
        {
            Bll_File fileInstance = new Bll_File();
            //如果存在该文档
            if (RefCompList.Keys.Contains(cc.CCF_DCode))
            {
                var compList = RefCompList[cc.CCF_DCode];

                foreach (var comp in compList)
                {
                    string lastpath = GlabolConfiguration.SeverPath + "\\" + comp.PRDC_CompNo;
                    if (!Directory.Exists(lastpath))
                    {
                        try
                        {
                            Directory.CreateDirectory(lastpath);
                        }
                        catch (Exception ex)
                        {
                            //写入数据库日志
                            PlateLog.WriteError(SessionConfig.UserID, SessionConfig.UserName,
                                "", "CompManage 多零件同步",
                               ex.Message, PlateLog.LogMessageType.Error, ex);
                        }
                    }

                    File.Copy(GlabolConfiguration.SeverPath + cc.CCF_Directory.Replace('/', '\\'), lastpath + "\\" + cc.CCF_Name + ".pdf");

                }
            }
        }