2025年8月25日 星期一

V20305E1 – [請料提出(EMAIL專案)]-來源: AMM – Email附檔 - 套表檔名 & 匯出檔名需不同檔案

 目的:V20305E1–[請料提出(EMAIL專案)]- Email附檔-套表檔名&匯出檔名不可相同

處理說明: 1> 套表檔名: "V20305_物料清單_請料提出_A.xlsx";
                        匯出檔案名稱:  "V20305_物料清單_請料提出_A_"+yyyymmdd+".xlsx";                                              string Tmp_FName = "V20305_物料清單_請料提出_A.xlsx";   //套表檔名
                        string Tmp_FName1 = ExportFile2(Tmp_FName, Tmp_AMMNOs);  //匯出檔案+日期
                ContentType ct1 = new ContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
                Attachment attm1 = new Attachment(Tmp_FName1, ct1);
                ChkMail.Attachments.Add(attm1);  
          
              2>匯出檔案名稱+yyyymmdd.xls
                    string Tmp_oFName = "V20305_物料清單_請料提出_A_" 
                                                  + DateTime.Now.ToString("yyyyMMdd") + ".xlsx";
                     string FileName1 = documentPath + Tmp_oFName;                
                     wk.SaveToFile(FileName1, FileFormat.Version2007);  //匯出報表檔案名稱




1>*.js
var Tmp_subject = "AMM V20305  交修件提料完成通知 ";
                var Tmp_content = " 拆檢提領編號(" + Tmp_OGONOAFs + ")<br>"
                    + " 件號(" + Tmp_PNs + ")<br>"
                    + "工廠已完成零件需求登錄<br><br>"
            + "附檔為 [V20305_物料清單_請料提出_A_" + DatetoStr(cnow(), "Ymd") +".xlsx]<br>"
                    + "已EMAIL通知[專案人員]&[發工人員]&[提料申請人員]<br>"
                    + "執行後續作業<br>";
                Tmp_content = Tmp_content.replace(/<br>/g, "\r\n");                
                //DTSOR='A' 的 EMAIL
                await Call_V20305E1(Tmp_subject, Tmp_content, Tmp_EMPLYIDs, Tmp_AMMNOs);

2>*.cs

public string ExportFile2(string par_FName,string par_AMMNOs)
        {
            string Tmp_FName = par_FName;      //套表的檔案名稱 , 
            //string documentPath = HttpContext.Current.Server.MapPath("~") + "document\\";
            //string pathFName = documentPath + Tmp_FName;
            FileStream fs = null;
            Workbook wk = null;
            fs = myfunc.get_SS_FILES(Tmp_FName);
            wk = new Workbook();
            wk.LoadFromStream(fs);
                :
 string documentPath = HttpContext.Current.Server.MapPath("~") + "document\\";  // 取得實實的路徑                  //匯出報表檔案名稱 : Tmp_oFName  不可和套表名稱一樣
               string Tmp_oFName = "V20305_物料清單_請料提出_A_" 
                                                  + DateTime.Now.ToString("yyyyMMdd") + ".xlsx";
                string FileName1 = documentPath + Tmp_oFName;                
                wk.SaveToFile(FileName1, FileFormat.Version2007);  //匯出報表檔案名稱
                return FileName1;


沒有留言:

張貼留言