예제 #1
0
        public void SavePath()
        {
            Bll_Doc docInstance = new Bll_Doc();

            try
            {
                string compno = compNoEditor.Text;
                string parent = compno;
                Bll_File fileInstance = new Bll_File();
                //fileInstance.GotoDirectory(".");

                //if (!fileInstance.ftp.DirectoryExist(parent))
                //{
                //    try
                //    {

                //        fileInstance.ftp.MakeDirectory(parent);
                //    }
                //    catch
                //    {
                //        Alert.Show("请确认网路是否通畅!");
                //    }
                //}

                string lastpath = GlabolConfiguration.SeverPath + "\\" + parent;

                if (!Directory.Exists(lastpath))
                {
                    try
                    {
                        Directory.CreateDirectory(lastpath);

                    }
                    catch (Exception ex)
                    {

                    }

                }

                //fileInstance.ftp.GotoDirectory(parent);

                foreach (var file in CCFileList)
                {
                    string source = file.CCF_Directory;
                    file.CCF_Code = docInstance.GenerateCCFileCode();
                    file.CCF_Directory = "/" + parent + "/" + file.CCF_Name + ".pdf";
                    file.CCF_iType = "Comp";
                    file.CCF_CompNo = parent;
                    docInstance.AddCCFile(file);
                    File.Copy(source, lastpath + "\\" + file.CCF_Name + ".pdf", true);

                }//当前窗体对应的零件文档上传 end

                foreach (var cc in CCFileList)
                {
                    SaveRefPath(cc);
                }
            }
            catch (Exception e)
            {
                //写入数据库日志
                PlateLog.WriteError(SessionConfig.UserID, SessionConfig.UserName,
                    "", "CompManage",
                   e.Message, PlateLog.LogMessageType.Error, e);
            }//保存完毕后清除需要上传的文件
            finally
            {
                if (CCFileList.Count != 0)
                {
                    SyncProdDocument();
                }

                CCFileList = new List<CC_File>();

            }

            //if (IsDeleted)
            //{
            //    DeleteDocument();
            //}
        }
예제 #2
0
        public void SavePath()
        {
            Bll_Doc docInstance = new Bll_Doc();
            Bll_File fileInstance1 = new Bll_File();

            try
            {
                var com = bmHelper.FindCtl<UltraCombo>(this.pnlGrid.Controls, "PRM_ProdCode");
                string parent = com.Value.ToString();

                string lastpath = GlabolConfiguration.SeverPath + "\\" + parent;
                if (!Directory.Exists(lastpath))
                {
                    try
                    {
                        Directory.CreateDirectory(lastpath);

                    }
                    catch (Exception ex)
                    {

                    }

                }

                foreach (var file in CCFileList)
                {
                    string source = file.CCF_Directory;
                    file.CCF_Code = docInstance.GenerateCCFileCode();
                    file.CCF_Directory = "/" + parent + "/" + file.CCF_Name + ".pdf";
                    file.CCF_iType = "ProdRepair";
                    file.CCF_CompNo = parent;
                    docInstance.AddCCFile(file);

                    File.Copy(source, lastpath + "\\" + file.CCF_Name + ".pdf", true);

                }

                //fileInstance1.GotoDirectory(".");
                //if (!fileInstance1.ftp.DirectoryExist(parent))
                //{
                //    try
                //    {
                //        fileInstance1.ftp.MakeDirectory(parent);
                //    }
                //    catch (Exception ex)
                //    {

                //    }
                //}

                //fileInstance1.ftp.GotoDirectory(parent);

                //foreach (var file in CCFileList)
                //{
                //    switch (opType)
                //    {

                //        case OperationTypeEnum.Add:
                //            {
                //                var flag = fileInstance1.ftp.UploadLocalFileWithOverWrite(file.CCF_Directory);

                //                if (flag)
                //                {

                //                    file.CCF_Code = docInstance.GenerateCCFileCode();
                //                    file.CCF_Directory = "/" + parent + "/" + file.CCF_Name + ".pdf";
                //                    file.CCF_iType = "Prod";
                //                    file.CCF_CompNo = parent;
                //                    docInstance.AddCCFile(file);
                //                }
                //                break;
                //            }
                //        case OperationTypeEnum.Edit:
                //            {

                //                var flag = fileInstance1.ftp.UploadLocalFileWithOverWrite(file.CCF_Directory);

                //                if (flag)
                //                {

                //                    file.CCF_Code = docInstance.GenerateCCFileCode();
                //                    file.CCF_Directory = "/" + parent + "/" + file.CCF_Name + ".pdf";
                //                    file.CCF_iType = "Prod";
                //                    file.CCF_CompNo = parent;
                //                    docInstance.AddCCFile(file);
                //                }

                //                break;
                //            }
                //    }

                //}//当前窗体对应的零件文档上传

            }
            catch (Exception e)
            {
                //写入数据库日志
                PlateLog.WriteError(SessionConfig.UserID, SessionConfig.UserName,
                    "", "ProdIO",
                   e.Message, PlateLog.LogMessageType.Error, e);
            }//保存完毕后清除需要上传的文件
            finally
            {

                CCFileList = new List<CC_File>();
            }

            //if (IsDeleted)
            //{
            //    DeleteDocument();
            //}
        }
예제 #3
0
        public void SavePath()
        {
            Bll_Doc docInstance = new Bll_Doc();

            try
            {
                string compno = compNoEditor.Text;
                string parent = compno;
                Bll_File fileInstance = new Bll_File();
                //fileInstance.GotoDirectory(".");

                //if (!fileInstance.ftp.DirectoryExist(parent))
                //{
                //    try
                //    {

                //        fileInstance.ftp.MakeDirectory(parent);
                //    }
                //    catch
                //    {
                //        Alert.Show("请确认网路是否通畅!");
                //    }
                //}

                string lastpath = GlabolConfiguration.SeverPath + "\\" + parent;

                if (!Directory.Exists(lastpath))
                {
                    try
                    {
                        Directory.CreateDirectory(lastpath);

                    }
                    catch (Exception ex)
                    {

                    }

                }

                //fileInstance.ftp.GotoDirectory(parent);

                foreach (var file in CCFileList)
                {
                    //switch (opType)
                    //{
                    //    ///添加零件的话  需要创建零件编号文件夹
                    //    case OperationTypeEnum.Add:
                    //        {
                    //var flag = fileInstance.UploadFile(file.CCF_Directory, true);

                    //var flag = fileInstance.ftp.UploadLocalFileWithOverWrite(file.CCF_Directory);

                    //if (flag)
                    //{
                    string source = file.CCF_Directory;
                    file.CCF_Code = docInstance.GenerateCCFileCode();
                    file.CCF_Directory = "/" + parent + "/" + file.CCF_Name + ".pdf";
                    file.CCF_iType = "Other";
                    file.CCF_CompNo = compno;
                    docInstance.AddCCFile(file);

                    File.Copy(source, lastpath + "\\" + file.CCF_Name + ".pdf", true);

                    //}
                    //        break;
                    //    }
                    //case OperationTypeEnum.Edit:
                    //    {

                    //        var flag = fileInstance.ftp.UploadLocalFileWithOverWrite(file.CCF_Directory);
                    //        if (flag)
                    //        {

                    //            file.CCF_Code = docInstance.GenerateCCFileCode();
                    //            file.CCF_Directory = "/" + parent + "/" + file.CCF_Name + ".pdf";
                    //            file.CCF_iType = "Comp";
                    //            file.CCF_CompNo = compno;
                    //            docInstance.AddCCFile(file);
                    //        }

                    //        break;
                    //    }
                    //}

                }//当前窗体对应的零件文档上传 end

            }
            catch (Exception e)
            {
                //写入数据库日志
                PlateLog.WriteError(SessionConfig.UserID, SessionConfig.UserName,
                    "", "OtherCompOp",
                   e.Message, PlateLog.LogMessageType.Error, e);
            }//保存完毕后清除需要上传的文件
            finally
            {
                if (CCFileList.Count != 0)
                {
                    //SyncProdDocument();
                }

                CCFileList = new List<CC_File>();

            }

            //if (IsDeleted)
            //{
            //    DeleteDocument();
            //}
        }
예제 #4
0
파일: ProdIO.cs 프로젝트: youthjoy/cshelper
        /// <summary>
        /// 文档同步(对于添加的文档)
        /// </summary>
        public void SyncDocument()
        {
            try
            {
                //BLL.Bll_File fileInstance = new QX.BLL.Bll_File();
                Bll_Doc docInstance = new Bll_Doc();

                //建立成品文件夹(是否存在)
                if (!fileInstance.ftp.DirectoryExist(GModel.PRP_ProdCode))
                {
                    try
                    {
                        fileInstance.ftp.MakeDirectory(GModel.PRP_ProdCode);
                    }
                    catch (Exception ex)
                    {
                        //写入数据库日志
                        PlateLog.WriteError(SessionConfig.UserID, SessionConfig.UserName,
                            "", "ProdIO",
                           ex.Message, PlateLog.LogMessageType.Error, ex);
                    }
                }
                ///获取文档列表
                var cclist = compInstance.GetCCFileListByComp(PCompList);

                string basePath = "./" + GModel.PRP_ProdCode;

                //移动相应的零件文档到该成品文件夹(先建立零件文件夹->移动文件)
                foreach (var c in PCompList)
                {
                    string compPath = c.PRDC_CompNo;
                    string remotePath = basePath + "/" + compPath;

                    //使当前目录置于成品文件夹中
                    fileInstance.GotoDirectory(basePath);
                    //对应的成品文件夹中该零件编号文件夹是否存在,不存在则创建
                    if (!fileInstance.ftp.DirectoryExist(compPath))
                    {
                        try
                        {
                            //创建零件编号文件夹
                            fileInstance.ftp.MakeDirectory(compPath);
                        }
                        catch (Exception ee)
                        {  //写入数据库日志
                            PlateLog.WriteError(SessionConfig.UserID, SessionConfig.UserName,
                                "", "ProdIO 写入零件",
                               ee.Message, PlateLog.LogMessageType.Error, ee);

                        }
                    }
                    //进入零件原文档存储目录
                    fileInstance.GotoDirectory("./" + compPath);
                    var templist = cclist.Where(o => o.CCF_CompNo == c.PRDC_CompNo);
                    foreach (var f in templist)
                    {
                        string name = Path.GetFileName(f.CCF_Directory);

                        fileInstance.ftp.CopyFileToAnotherDirectoryOverWrite(name, remotePath);
                        //把零件对应的存储目录更新一遍(融入到相应成品文件夹中)
                        //f.CCF_Directory = "/" + GModel.PRP_ProdCode+f.CCF_Directory;
                        //docInstance.UpdateCCFile(f);

                    }
                }
            }
            catch (Exception ex)
            {
                //写入数据库日志
                PlateLog.WriteError(SessionConfig.UserID, SessionConfig.UserName,
                    "", "ProdIO",
                   ex.Message, PlateLog.LogMessageType.Error, ex);
            }
        }
예제 #5
0
        public void SavePath()
        {
            Bll_Doc docInstance = new Bll_Doc();
            try
            {
                string parent = CompSource[0].PRDC_CompNo;

                string lastpath = GlabolConfiguration.SeverPath + "\\" + parent;

                if (!Directory.Exists(lastpath))
                {
                    try
                    {
                        Directory.CreateDirectory(lastpath);
                    }
                    catch (Exception ex)
                    {

                    }
                }

                foreach (var file in CCFileList)
                {
                    string source = file.CCF_Directory;
                    file.CCF_Code = docInstance.GenerateCCFileCode();
                    file.CCF_Directory = "/" + parent + "/" + file.CCF_Name + ".pdf";
                    file.CCF_iType = "Comp";
                    file.CCF_CompNo = parent;
                    docInstance.AddCCFile(file);

                    File.Copy(source, lastpath + "\\" + file.CCF_Name + ".pdf", true);
                }//当前窗体对应的零件文档上传

                foreach (var cc in CCFileList)
                {
                    SaveRefPath(cc);
                }
            }
            catch (Exception e)
            {
                //写入数据库日志
                PlateLog.WriteError(SessionConfig.UserID, SessionConfig.UserName,
                    "", "CompManage",
                   e.Message, PlateLog.LogMessageType.Error, e);
            }//保存完毕后清除需要上传的文件
            finally
            {
                if (CCFileList.Count != 0)
                {
                    SyncProdDocument();
                }

                CCFileList = new List<CC_File>();
            }

            //if (IsDeleted)
            //{
            //    DeleteDocument();
            //}
        }