Ejemplo n.º 1
0
        public static void creatCOPYSH(Dictionary <string, string> rncaao, bool overcover = false, bool closeword = true)
        {
            BackupOperation.backupfile(rncaao["复制单保存地址"]);
            if (!rncaao.Keys.Contains("图纸名称"))
            {
                rncaao.Add("图纸名称", AutorivetDB.queryno(rncaao["图号"], "图纸名称"));
            }



            var wordApp = new Microsoft.Office.Interop.Word.Application();

            wordApp.Visible = !closeword;
            var myAO = new Document();

            if (File.Exists(rncaao["复制单保存地址"]) && (!overcover))
            {
                myAO = wordApp.Documents.Open(rncaao["复制单保存地址"]);
            }
            else
            {
                try
                {
                    File.Copy(Program.InfoPath + "SAMPLE\\RULE\\REPROD_SH.doc", rncaao["复制单保存地址"], true);
                }
                catch
                {
                    MessageBox.Show("生成文件" + rncaao["图号"] + "复制单未成功,请关闭所有打开的word,运行kill word!");
                    return;
                }


                myAO = wordApp.Documents.Open(rncaao["复制单保存地址"]);
            }

            //处理程序编号
            int progno = System.Convert.ToInt32(rncaao["程序编号"].Substring(5, 2));



            //复制单编号

            myAO.Tables[1].Cell(1, 5).Range.Text = "S2B-NCC-22100-" + progno.ToString();

            wordMethod.SearchReplace(wordApp, myAO, "[5]", rncaao["图号"]);
            wordMethod.SearchReplace(wordApp, myAO, "[6]", rncaao["中文名称"] + "壁板组件");
            wordMethod.SearchReplace(wordApp, myAO, "[8]", rncaao["程序编号"]);



            myAO.Save();
            //  Form_method.scanfiledoc(rncaao["复制单保存地址"], myAO, closeword);
            //  MessageBox.Show("生成完毕,请补全其他信息");



            // return myAO;
        }
Ejemplo n.º 2
0
 public static void open_file_local(object filepath)
 {
     //备份文件
     BackupOperation.backupfile((string)filepath);
     System.Diagnostics.Process aa = new System.Diagnostics.Process();
     aa.StartInfo = new System.Diagnostics.ProcessStartInfo((string)filepath);
     aa.Start();
     Thread.Sleep(5);
 }
Ejemplo n.º 3
0
        public static void open_process(object filepath)
        {
            //备份文件
            BackupOperation.backupfile((string)filepath);
            //使用Fastip 打开



            Process_Method aa = new Process_Method((string)filepath);
            // aa.iniProc();
        }
Ejemplo n.º 4
0
        private void button9_Click(object sender, EventArgs e)
        {
            var kkk = from DataGridViewRow dd in dataGridView1.Rows
                      where Convert.ToBoolean(dd.Cells["choose"].Value) == true
                      select dd.Cells["地址"].Value.ToString();

            foreach (string pp in kkk)
            {
                if (File.Exists(pp))
                {
                    BackupOperation.backupfile(pp);
                    File.Delete(pp);
                }
                DbHelperSQL.ExecuteSql("delete from paperwork where 文件地址='" + pp.Replace("\\", "\\\\") + "';");
            }


            MessageBox.Show("执行成功");
            get_datatable();
            rf_filter();
        }
Ejemplo n.º 5
0
        private void button8_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("工具会首先杀死所有的word进程,请先保存当前的word工作,然后点击确定", "警告", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                FormMethod.killProcess("WINWORD");
                int count = Convert.ToInt16(dataGridView1.Rows.Count.ToString());

                for (int i = 0; i < count; i++)
                {
                    DataRowView temprow = (DataRowView)dataGridView1.Rows[i].DataBoundItem;
                    DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells["choose"];
                    Boolean flag = Convert.ToBoolean(checkCell.Value);
                    if (flag == true)     //查找被选择的数据行
                    {
                        string[] strobj = new string[3];
                        strobj[0] = temprow["地址"].ToString();
                        strobj[1] = textBox3.Text;
                        strobj[2] = textBox4.Text;

                        BackupOperation.backupfile(temprow["地址"].ToString());
                        //Thread t1 = new Thread(new ParameterizedThreadStart(replacethread));
                        //t1.Start(strobj);

                        Task.Factory.StartNew(replacethread, strobj);



                        //  wordMethod.SearchReplace(sourcepath, textBox3.Text, textBox4.Text);
                        //   checkCell.Value = false;
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            //  checkBox3.Checked = false;
            Task.WaitAll();
            MessageBox.Show("完成");
        }
Ejemplo n.º 6
0
        public static void creatPACR(Dictionary <string, string> rncaao, bool overcover = false, bool closeword = true)
        {
            BackupOperation.backupfile(rncaao["PACR保存地址"]);
            if (!rncaao.Keys.Contains("图纸名称"))
            {
                rncaao.Add("图纸名称", AutorivetDB.queryno(rncaao["图号"], "图纸名称"));
            }



            var wordApp = new Microsoft.Office.Interop.Word.Application();

            wordApp.Visible = !closeword;
            var myAO = new Document();

            if (File.Exists(rncaao["PACR保存地址"]) && (!overcover))
            {
                myAO = wordApp.Documents.Open(rncaao["PACR保存地址"]);
            }
            else
            {
                try
                {
                    File.Copy(Program.InfoPath + "SAMPLE\\AOI\\PACR.doc", rncaao["PACR保存地址"], true);
                }
                catch
                {
                    MessageBox.Show("生成文件" + rncaao["图号"] + "PACR未成功,请关闭所有打开的word,运行kill word!");
                    return;
                }


                myAO = wordApp.Documents.Open(rncaao["PACR保存地址"]);
            }



            //控制记录编号
            wordMethod.SearchReplace(wordApp, myAO, "[1]", rncaao["AOI编号"] + "-PACR");
            //      myAO.Tables[1].Cell(2, 6).Range.Text = rncaao["AOI编号"] + "-PACR";
            //myAO.Tables[2].Cell(2, 6).Range.Text = rncaao["AOI编号"] + "-PACR";
            //myAO.Tables[3].Cell(2, 6).Range.Text = rncaao["AOI编号"] + "-PACR";
            //myAO.Tables[4].Cell(2, 6).Range.Text = rncaao["AOI编号"] + "-PACR";

            //控制记录名称


            myAO.Tables[1].Cell(4, 3).Range.Text = "自动钻铆\rAUTO-RIVETING";

            //装配图号
            //myAO.Tables[1].Cell(4, 2).Range.Text = rncaao["装配图号"];
            myAO.Tables[1].Cell(10, 1).Range.Text = "1";
            myAO.Tables[1].Cell(10, 2).Range.Text = rncaao["装配图号"];
            myAO.Tables[1].Cell(10, 3).Range.Text = rncaao["中文名称"] + "壁板组件\r" + rncaao["图纸名称"];
            // myAO.Tables[1].Cell(10, 5).Range.Text = rncaao["图纸版次"];
            //程序编号

            myAO.Tables[1].Cell(16, 1).Range.Text = "1";
            myAO.Tables[1].Cell(16, 2).Range.Text = rncaao["程序编号"];
            //2015.8.13不再需要状态编号
            //   myAO.Tables[1].Cell(16, 6).Range.Text = rncaao["状态编号"];
            //  myAO.Tables[1].Cell(16, 7).Range.Text = rncaao["中文名称"] + "壁板装配交付状态\rCOS OF " + rncaao["图纸名称"];



            //进入零件表填写


            //第一条


            myAO.Tables[4].Cell(5, 1).Range.Text = "1";
            //     myAO.Tables[2].Cell(3, 1).Height=
            myAO.Tables[4].Cell(5, 2).Range.Text = rncaao["图号"];
            myAO.Tables[4].Cell(5, 3).Range.Text = rncaao["中文名称"] + "壁板组件\r" + rncaao["图纸名称"];
            myAO.Tables[4].Cell(5, 4).Range.Text = "A";
            myAO.Tables[4].Cell(5, 5).Range.Text = "1";
            //    myAO.Tables[4].Cell(5, 6).Range.Text = rncaao["装配图号"];

            // myAO.Tables[1].Cell(7, 10).Range.Text = rncaao["架次"];
            // myAO.Tables[1].Cell(7, 1).Range.Text = dataGridView1.Rows[0].

            //开始统计紧固件

            System.Data.DataTable fsttable = AutorivetDB.allqtytable(rncaao["图号"]);;

            int fstcount = fsttable.Rows.Count;
            int nut5     = 0;
            int nut6     = 0;

            if (fstcount != 0)
            {
                for (int i = 0; i < fstcount; i++)
                {
                    string fstno = fsttable.Rows[i][0].ToString();
                    myAO.Tables[4].Cell(6 + i, 1).Range.Text = (i + 2).ToString();
                    myAO.Tables[4].Cell(6 + i, 2).Range.Text = fstno;
                    //string fstname = "";


                    if (fstno.Contains("B020600"))
                    {
                        myAO.Tables[4].Cell(6 + i, 3).Range.Text = "高锁\rHI-LITE";
                        int hiqty = System.Convert.ToInt16(fsttable.Rows[i][1].ToString());

                        if (fstno.Contains("AG5"))
                        {
                            nut5 = nut5 + hiqty;
                        }
                        else
                        {
                            nut6 = nut6 + hiqty;
                        }
                    }
                    else
                    {
                        myAO.Tables[4].Cell(6 + i, 3).Range.Text = "铆钉\rRIVET";
                    }
                    myAO.Tables[4].Cell(6 + i, 4).Range.Text = "U";
                    myAO.Tables[4].Cell(6 + i, 5).Range.Text = fsttable.Rows[i][1].ToString();
                    //   myAO.Tables[4].Cell(6 + i, 6).Range.Text = rncaao["装配图号"];
                }



                fstcount = 6 + fstcount;
                if (nut5 != 0)
                {
                    myAO.Tables[4].Cell(fstcount, 1).Range.Text = (fstcount - 2).ToString();
                    myAO.Tables[4].Cell(fstcount, 2).Range.Text = "B0203013-08";
                    myAO.Tables[4].Cell(fstcount, 3).Range.Text = "高锁帽\rNUT";
                    myAO.Tables[4].Cell(fstcount, 4).Range.Text = "U";
                    myAO.Tables[4].Cell(fstcount, 5).Range.Text = nut5.ToString();
                    // myAO.Tables[4].Cell(fstcount, 6).Range.Text = rncaao["装配图号"];
                    if (nut6 != 0)
                    {
                        fstcount = fstcount + 1;
                        myAO.Tables[4].Cell(fstcount, 1).Range.Text = (fstcount - 2).ToString();
                        myAO.Tables[4].Cell(fstcount, 2).Range.Text = "B0203013-3";
                        myAO.Tables[4].Cell(fstcount, 3).Range.Text = "高锁帽\rNUT";
                        myAO.Tables[4].Cell(fstcount, 4).Range.Text = "U";
                        myAO.Tables[4].Cell(fstcount, 5).Range.Text = nut6.ToString();
                        //  myAO.Tables[4].Cell(fstcount, 6).Range.Text = rncaao["装配图号"];
                    }
                }
                else
                {
                    if (nut6 != 0)
                    {
                        //fstcount = fstcount + 1;
                        myAO.Tables[4].Cell(fstcount, 1).Range.Text = (fstcount - 2).ToString();
                        myAO.Tables[4].Cell(fstcount, 2).Range.Text = "B0203013-3";
                        myAO.Tables[4].Cell(fstcount, 3).Range.Text = "高锁帽\rNUT";
                        myAO.Tables[4].Cell(fstcount, 4).Range.Text = "U";
                        myAO.Tables[4].Cell(fstcount, 5).Range.Text = nut6.ToString();
                        myAO.Tables[4].Cell(fstcount, 6).Range.Text = rncaao["装配图号"];
                    }
                }
                //添加密封胶
                if ((nut5 + nut6) == 0)
                {
                }
                else
                {
                    fstcount = fstcount + 1;
                }

                myAO.Tables[4].Cell(fstcount, 1).Range.Text = (fstcount - 2).ToString();
                myAO.Tables[4].Cell(fstcount, 3).Range.Text = "密封剂\rSEALANT";
                myAO.Tables[4].Cell(fstcount, 2).Range.Text = "MIL-PRF-81733 Type IV";
                myAO.Tables[4].Cell(fstcount, 4).Range.Text = "M";
                myAO.Tables[4].Cell(fstcount, 5).Range.Text = "340g";
                //  myAO.Tables[4].Cell(fstcount, 6).Range.Text = rncaao["装配图号"];


                fstcount = fstcount + 1;
            }



            myAO.Save();
            FormMethod.scanfiledoc(rncaao["PACR保存地址"], myAO, closeword);
            //  MessageBox.Show("生成完毕,请补全其他信息");



            // return myAO;
        }
Ejemplo n.º 7
0
        public static Document creatAOI(Dictionary <string, string> rncaao, bool overcover = false, bool closeword = true)
        {
            BackupOperation.backupfile(rncaao["AOI保存地址"]);
            if (!rncaao.Keys.Contains("图纸名称"))
            {
                rncaao.Add("图纸名称", AutorivetDB.queryno(rncaao["图号"], "图纸名称"));
            }



            var wordApp = new Microsoft.Office.Interop.Word.Application();



            wordApp.Visible = !closeword;

            Document myAO;


            if (File.Exists(rncaao["AOI保存地址"]) && (!overcover))
            {
                myAO = wordApp.Documents.Open(rncaao["AOI保存地址"]);
            }
            else
            {
                try
                {
                    File.Copy(Program.InfoPath + "SAMPLE\\AOI\\AOI.docx", rncaao["AOI保存地址"], true);
                }
                catch
                {
                    MessageBox.Show("生成文件" + rncaao["图号"] + "AOI未成功,请关闭所有打开的word,运行kill word!");
                    return(null);
                }


                myAO = wordApp.Documents.Open(rncaao["AOI保存地址"]);
                Thread.Sleep(100);
                // myAO.SaveAs2(rncaao["AOI保存地址"]);
            }



            //替换所有编号
            wordMethod.SearchReplace(wordApp, myAO, "[2]", rncaao["AOI编号"]);


            //上下工序

            //     myAO.Tables[1].Cell(4, 4).Range.Text =

            string prezhanwei = AutorivetDB.queryno(rncaao["图号"], "预铆编号");

            myAO.Tables[1].Cell(4, 4).Range.Text = "C1-" + prezhanwei + "-020";

            myAO.Tables[1].Cell(4, 6).Range.Text = "C1-" + prezhanwei + "-030";
            //标题



            myAO.Tables[1].Cell(3, 4).Range.Text = "自动钻铆\rAUTO-RIVETING";
            //替换所有装配图号

            wordMethod.SearchReplace(wordApp, myAO, "[1]", rncaao["装配图号"]);



            //进入零件表填写


            //第一条


            myAO.Tables[2].Cell(3, 1).Range.Text = "1";
            //     myAO.Tables[2].Cell(3, 1).Height=
            myAO.Tables[2].Cell(3, 2).Range.Text = rncaao["图号"] + "P1";
            myAO.Tables[2].Cell(3, 3).Range.Text = rncaao["中文名称"] + "壁板组件\r" + rncaao["图纸名称"];
            myAO.Tables[2].Cell(3, 4).Range.Text = "A";
            myAO.Tables[2].Cell(3, 5).Range.Text = "1";
            myAO.Tables[2].Cell(3, 6).Range.Text = rncaao["装配图号"];
            if (rncaao["图号"].Contains("C017"))
            {
                myAO.Tables[1].Cell(3, 6).Range.Text = "☒CS100☑CS300";
            }


            // myAO.Tables[1].Cell(7, 10).Range.Text = rncaao["架次"];
            // myAO.Tables[1].Cell(7, 1).Range.Text = dataGridView1.Rows[0].

            //开始统计紧固件

            // System.Data.DataTable fsttable = autorivet_op.spfsttable(rncaao["图号"]);
            //2015.7.28改为统计加入试片耗损后的紧固件数量
            System.Data.DataTable fsttable = AutorivetDB.allqtytable(rncaao["图号"]);

            int fstcount = fsttable.Rows.Count;
            int nut5     = 0;
            int nut6     = 0;

            if (fstcount != 0)
            {
                for (int i = 0; i < fstcount; i++)
                {
                    string fstno = fsttable.Rows[i][0].ToString();
                    myAO.Tables[2].Cell(4 + i, 1).Range.Text = (i + 2).ToString();
                    myAO.Tables[2].Cell(4 + i, 2).Range.Text = fstno;
                    //string fstname = "";


                    if (fstno.Contains("B020600"))
                    {
                        myAO.Tables[2].Cell(4 + i, 3).Range.Text = "高锁\rHI-LITE";
                        int hiqty = System.Convert.ToInt16(fsttable.Rows[i][1].ToString());

                        if (fstno.Contains("AG5"))
                        {
                            nut5 = nut5 + hiqty;
                        }
                        else
                        {
                            nut6 = nut6 + hiqty;
                        }
                    }
                    else
                    {
                        myAO.Tables[2].Cell(4 + i, 3).Range.Text = "铆钉\rRIVET";
                    }
                    myAO.Tables[2].Cell(4 + i, 4).Range.Text = "U";
                    myAO.Tables[2].Cell(4 + i, 5).Range.Text = fsttable.Rows[i][1].ToString();
                    myAO.Tables[2].Cell(4 + i, 6).Range.Text = rncaao["装配图号"];
                }



                fstcount = 4 + fstcount;
                if (nut5 != 0)
                {
                    myAO.Tables[2].Cell(fstcount, 1).Range.Text = (fstcount - 2).ToString();
                    myAO.Tables[2].Cell(fstcount, 2).Range.Text = "B0203013-08";
                    myAO.Tables[2].Cell(fstcount, 3).Range.Text = "高锁帽\rNUT";
                    myAO.Tables[2].Cell(fstcount, 4).Range.Text = "U";
                    myAO.Tables[2].Cell(fstcount, 5).Range.Text = nut5.ToString();
                    myAO.Tables[2].Cell(fstcount, 6).Range.Text = rncaao["装配图号"];
                    if (nut6 != 0)
                    {
                        fstcount = fstcount + 1;
                        myAO.Tables[2].Cell(fstcount, 1).Range.Text = (fstcount - 2).ToString();
                        myAO.Tables[2].Cell(fstcount, 2).Range.Text = "B0203013-3";
                        myAO.Tables[2].Cell(fstcount, 3).Range.Text = "高锁帽\rNUT";
                        myAO.Tables[2].Cell(fstcount, 4).Range.Text = "U";
                        myAO.Tables[2].Cell(fstcount, 5).Range.Text = nut6.ToString();
                        myAO.Tables[2].Cell(fstcount, 6).Range.Text = rncaao["装配图号"];
                    }
                }
                else
                {
                    if (nut6 != 0)
                    {
                        //fstcount = fstcount + 1;
                        myAO.Tables[2].Cell(fstcount, 1).Range.Text = (fstcount - 2).ToString();
                        myAO.Tables[2].Cell(fstcount, 2).Range.Text = "B0203013-3";
                        myAO.Tables[2].Cell(fstcount, 3).Range.Text = "高锁帽\rNUT";
                        myAO.Tables[2].Cell(fstcount, 4).Range.Text = "U";
                        myAO.Tables[2].Cell(fstcount, 5).Range.Text = nut6.ToString();
                        myAO.Tables[2].Cell(fstcount, 6).Range.Text = rncaao["装配图号"];
                    }
                }
                //添加密封胶
                if ((nut5 + nut6) == 0)
                {
                }
                else
                {
                    fstcount = fstcount + 1;
                }

                myAO.Tables[2].Cell(fstcount, 1).Range.Text = (fstcount - 2).ToString();
                myAO.Tables[2].Cell(fstcount, 3).Range.Text = "密封剂\rSEALANT";
                myAO.Tables[2].Cell(fstcount, 2).Range.Text = "MIL-PRF-81733 Type IV";
                myAO.Tables[2].Cell(fstcount, 4).Range.Text = "M";
                myAO.Tables[2].Cell(fstcount, 5).Range.Text = "340g";
                myAO.Tables[2].Cell(fstcount, 6).Range.Text = rncaao["装配图号"];

                //添加胶嘴
                //fstcount = fstcount + 1;
                //List<string> tipls = autorivet_op.processitemlist(rncaao["装配图号"], "胶嘴Sealant_Tip");
                //for (int k=0;k<tipls.Count();k++)
                //{

                //    myAO.Tables[2].Cell(fstcount+k, 1).Range.Text = (fstcount+k - 2).ToString();
                //    myAO.Tables[2].Cell(fstcount + k, 2).Range.Text = tipls[k];
                //    myAO.Tables[2].Cell(fstcount + k, 3).Range.Text = "胶嘴\rSealant Tip";
                //    myAO.Tables[2].Cell(fstcount + k, 4).Range.Text = "M";
                //    myAO.Tables[2].Cell(fstcount + k, 5).Range.Text = "1";
                //    myAO.Tables[2].Cell(fstcount + k, 6).Range.Text = rncaao["装配图号"];

                //}

                //添加下铆头

                fstcount = fstcount + 1;


                while (!myAO.Tables[2].Cell(fstcount, 1).Range.Text.Contains("专用工具"))
                {
                    fstcount = fstcount + 1;
                }

                //定位到要输入专用工具的行
                fstcount = fstcount + 2;



                List <string> lals = AutorivetDB.processitemlist(rncaao["装配图号"], "下铆头Lower_Anvil");
                //最多只能放下三行
                //用于记录行尾,指示下一行数据的索引;
                int rear = fstcount;

                for (int k = 0; k < lals.Count(); k++)
                {
                    myAO.Tables[2].Cell(rear, 1).Range.Text = (k + 1).ToString();
                    myAO.Tables[2].Cell(rear, 2).Range.Text = "下铆头\rLower Anvil";
                    myAO.Tables[2].Cell(rear, 3).Range.Text = "1";
                    myAO.Tables[2].Cell(rear, 4).Range.Text = lals[k];

                    rear = rear + 1;
                }
                //高锁限力枪
                int toolindex = lals.Count();
                if (nut5 > 0)
                {
                    toolindex = toolindex + 1;
                    myAO.Tables[2].Cell(rear, 1).Range.Text = toolindex.ToString();
                    myAO.Tables[2].Cell(rear, 2).Range.Text = "高锁限力枪\rHI-LITE Istallation Tool";
                    myAO.Tables[2].Cell(rear, 3).Range.Text = "1";
                    myAO.Tables[2].Cell(rear, 4).Range.Text = "KTL1408A218B062";
                    toolindex += 1;
                    rear      += 1;
                }

                if (nut6 > 0)
                {
                    toolindex = toolindex + 1;
                    myAO.Tables[2].Cell(rear, 1).Range.Text = toolindex.ToString();
                    myAO.Tables[2].Cell(rear, 2).Range.Text = "高锁限力枪\rHI-LITE Istallation Tool";
                    myAO.Tables[2].Cell(rear, 3).Range.Text = "1";
                    myAO.Tables[2].Cell(rear, 4).Range.Text = "KTL1439A249C078";
                    rear += 1;
                }


                //寻找图纸列表
                while (!myAO.Tables[2].Cell(rear, 1).Range.Text.Contains("图纸列表"))
                {
                    rear = rear + 1;
                }

                rear = rear + 2;



                //添加图纸

                myAO.Tables[2].Cell(rear, 1).Range.Text = "1";
                myAO.Tables[2].Cell(rear, 2).Range.Text = rncaao["装配图号"];
                myAO.Tables[2].Cell(rear, 3).Range.Text = rncaao["中文名称"] + "壁板组件\r" + rncaao["图纸名称"];



                //寻找程序列表
                while (!myAO.Tables[2].Cell(rear, 1).Range.Text.Contains("程序列表"))
                {
                    rear = rear + 1;
                }

                rear = rear + 2;

                //myAO.Tables[2].Cell(rear, 1).Range.Text = "1";
                //myAO.Tables[2].Cell(rear, 2).Range.Text = rncaao["程序编号"];

                //替换所有程序编号
                wordMethod.SearchReplace(wordApp, myAO, "[3]", rncaao["程序编号"]);


                rear = rear + 1;



                //寻找参考文件列表
                while (!myAO.Tables[2].Cell(rear, 1).Range.Text.Contains("参考文件列表"))
                {
                    rear = rear + 1;
                }

                rear = rear + 8;

                //判断并修改工装编号

                if (rncaao["中文名称"].Contains("下"))
                {
                    wordMethod.SearchReplace(wordApp, myAO, "C1-RIT-C01329000-001", "C1-RIT-C01333400-001");

                    wordMethod.SearchReplace(wordApp, myAO, "中中机身上半壳卡板", "中后机身下半壳卡板");

                    wordMethod.SearchReplace(wordApp, myAO, "Auto riveting framework of upper lobe MID fuselage CTR", "Auto riveting framework of lower lobe MID fuselage AFT");


                    wordMethod.SearchReplace(wordApp, myAO, "C1-RIT-C01322000-001", "C1-RIT-C01332300-001");
                    wordMethod.SearchReplace(wordApp, myAO, "中前机身上半壳卡板", "中前机身下半壳卡板");

                    wordMethod.SearchReplace(wordApp, myAO, "Auto riveting framework of upper lobe MID fuselage FWD", "Auto riveting framework of lower lobe MID fuselage FWD");
                }



                //2015.8.13不再需要状态编号
                //  myAO.Tables[2].Cell(rear, 2).Range.Text = rncaao["状态编号"];

                //替换所有状态编号
                //   wordMethod.SearchReplace(wordApp, myAO, "C1-S22100-33", rncaao["状态编号"]);



                //     myAO.Tables[2].Cell(rear, 3).Range.Text = rncaao["中文名称"] + "壁板装配交付状态\rCOS OF " + rncaao["图纸名称"];
            }



            myAO.Save();
            //   wordApp.Quit();
            FormMethod.scanfiledoc(rncaao["AOI保存地址"], myAO, closeword);
            //  MessageBox.Show("生成完毕,请补全其他信息");



            return(myAO);
        }
Ejemplo n.º 8
0
        public static void creatVERI(Dictionary <string, string> rncaao, bool overcover = false, bool closeword = true)
        {
            BackupOperation.backupfile(rncaao["鉴定表保存地址"]);
            if (!rncaao.Keys.Contains("图纸名称"))
            {
                rncaao.Add("图纸名称", AutorivetDB.queryno(rncaao["图号"], "图纸名称"));
            }



            var wordApp = new Microsoft.Office.Interop.Word.Application();

            wordApp.Visible = !closeword;
            var myAO = new Document();

            if (File.Exists(rncaao["鉴定表保存地址"]) && (!overcover))
            {
                myAO = wordApp.Documents.Open(rncaao["鉴定表保存地址"]);
            }
            else
            {
                try
                {
                    File.Copy(Program.InfoPath + "SAMPLE\\RULE\\VERI_SH.doc", rncaao["鉴定表保存地址"], true);
                }
                catch
                {
                    MessageBox.Show("生成文件" + rncaao["图号"] + "鉴定表未成功,请关闭所有打开的word,运行kill word!");
                    return;
                }


                myAO = wordApp.Documents.Open(rncaao["鉴定表保存地址"]);
            }

            //处理程序编号
            int progno = System.Convert.ToInt32(rncaao["程序编号"].Substring(5, 2));



            //鉴定表编号

            myAO.Tables[1].Cell(1, 5).Range.Text = "S2B-NCH-22100-" + progno.ToString();

            wordMethod.SearchReplace(wordApp, myAO, "[5]", rncaao["图号"]);
            wordMethod.SearchReplace(wordApp, myAO, "[6]", rncaao["中文名称"] + "壁板组件");
            wordMethod.SearchReplace(wordApp, myAO, "[7]", rncaao["图纸版次"]);
            wordMethod.SearchReplace(wordApp, myAO, "[11]", rncaao["程序编号"]);
            //开始处理试片编号
            //  DbHelperSQL.ExecuteSqlTran(autorivet_op.rfcouponno(rncaao["图号"]));

            //List< string> cplist=   DbHelperSQL.getlist("select CONCAT('T',编号) from 试片列表 where 产品图号='"+rncaao["图号"] + "' group by 编号 order by 编号;");

            //    string couponstr = rncaao["图号"].Replace("-001", cplist.First());

            //    for(int i=1;i<cplist.Count();i++)
            //    {
            //        couponstr = couponstr + "," + cplist[i];
            //    }

            //    wordMethod.SearchReplace(wordApp, myAO, "[8]", couponstr);
            myAO.Save();
            FormMethod.scanfiledoc(rncaao["鉴定表保存地址"], myAO, closeword);
            //  MessageBox.Show("生成完毕,请补全其他信息");



            // return myAO;
        }