Ejemplo n.º 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();
            //}
        }
Ejemplo n.º 2
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();
            //}
        }
Ejemplo n.º 3
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();
            //}
        }
Ejemplo n.º 4
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();
            //}
        }