コード例 #1
0
        private void SendMailInTime(string p_type)
        {
            Lib.Mail myMail = new Lib.Mail();
            switch (p_type)
            {
            case "jp_issue_compare":
                string        today_   = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString();
                string        mailBody = "附件为DMS-ERP下发对照表,请及时在两个系统中下发,使数据同步。";
                StringBuilder cmdText  = new StringBuilder("select a.part_no,a.mtr_no,PART_DESCRIPTION,part_unit,a.dms_issue_qty,b.erp_issue_qty  from (");

                cmdText.Append("select part_no,PART_DESCRIPTION,part_unit,matr_seq_no mtr_no,sum(nvl(issued_qty,0)) dms_issue_qty from jp_requisition t where rowstate in ('released','finished') ");
                cmdText.Append(string.Format(" and (finish_time is null or (finish_time>to_date('{0}','yyyy-mm-dd') and finish_time<to_date('{1}','yyyy-mm-dd')+1)) ", "1981-2-5", today_));
                cmdText.Append(" group by part_no,matr_seq_no,PART_DESCRIPTION,part_unit) a,(select t.sequence_no,sum(quantity) erp_issue_qty from ifsapp.inventory_transaction_hist2@erp_prod t ");
                cmdText.Append(" where t.dated>=to_date('2009-9-1','yyyy-mm-dd')  and t.transaction_code='PROJISS' group by t.sequence_no ) b ");
                cmdText.Append(" where a.mtr_no=b.sequence_no(+)");
                cmdText.Append(" and a.dms_issue_qty <> nvl(b.erp_issue_qty,0)");

                string attachmentFilePath = FileDir + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";     //create file ret file path
                if (!Misc.DBDataToXls(cmdText.ToString(), attachmentFilePath))
                {
                    return;
                }
                string[] attachmentFiles = new string[] { attachmentFilePath };
                string   mailTo          = "[email protected];[email protected]";
                //string mailTo = "[email protected];[email protected];[email protected];[email protected];[email protected];" +
                //    "[email protected];[email protected];[email protected];[email protected];[email protected];" +
                //    "[email protected];[email protected];[email protected];[email protected];" +
                //    "[email protected];[email protected];[email protected];[email protected];[email protected];" +
                //    "[email protected];[email protected];[email protected];[email protected];[email protected];" +
                //    "[email protected];[email protected];[email protected];[email protected];[email protected]";

                string mailCc = "*****@*****.**";
                // string mailCc = "[email protected];[email protected];[email protected];[email protected];[email protected]";

                myMail.Send("DMS-ERP下发对照-test", mailBody, "*****@*****.**", mailTo, mailCc, true, false, attachmentFiles, null);

                break;

            default:
                break;
            }
        }
コード例 #2
0
ファイル: TimeRun.cs プロジェクト: freudshow/raffles-codes
        private void SendMailInTime(string p_type)
        {
            Lib.Mail myMail = new Lib.Mail();
            switch (p_type)
            {
                case "jp_issue_compare":
                    string today_ = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString();
                    string mailBody = "����ΪDMS-ERP�·����ձ���뼰ʱ������ϵͳ���·���ʹ����ͬ����";
                    StringBuilder cmdText = new StringBuilder("select a.part_no,a.mtr_no,PART_DESCRIPTION,part_unit,a.dms_issue_qty,b.erp_issue_qty  from (");

                    cmdText.Append("select part_no,PART_DESCRIPTION,part_unit,matr_seq_no mtr_no,sum(nvl(issued_qty,0)) dms_issue_qty from jp_requisition t where rowstate in ('released','finished') ");
                    cmdText.Append(string.Format(" and (finish_time is null or (finish_time>to_date('{0}','yyyy-mm-dd') and finish_time<to_date('{1}','yyyy-mm-dd')+1)) ", "1981-2-5", today_));
                    cmdText.Append(" group by part_no,matr_seq_no,PART_DESCRIPTION,part_unit) a,(select t.sequence_no,sum(quantity) erp_issue_qty from ifsapp.inventory_transaction_hist2@erp_prod t ");
                    cmdText.Append(" where t.dated>=to_date('2009-9-1','yyyy-mm-dd')  and t.transaction_code='PROJISS' group by t.sequence_no ) b ");
                    cmdText.Append(" where a.mtr_no=b.sequence_no(+)");
                    cmdText.Append(" and a.dms_issue_qty <> nvl(b.erp_issue_qty,0)");

                    string attachmentFilePath = FileDir +  DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";//create file ret file path
                    if(!Misc.DBDataToXls(cmdText.ToString(), attachmentFilePath)) return;
                    string[] attachmentFiles = new string[] { attachmentFilePath };
                    string mailTo = "[email protected];[email protected]";
                    //string mailTo = "[email protected];[email protected];[email protected];[email protected];[email protected];" +
                    //    "[email protected];[email protected];[email protected];[email protected];[email protected];" +
                    //    "[email protected];[email protected];[email protected];[email protected];" +
                    //    "[email protected];[email protected];[email protected];[email protected];[email protected];" +
                    //    "[email protected];[email protected];[email protected];[email protected];[email protected];" +
                    //    "[email protected];[email protected];[email protected];[email protected];[email protected]";

                    string mailCc = "*****@*****.**";
                   // string mailCc = "[email protected];[email protected];[email protected];[email protected];[email protected]";

                    myMail.Send("DMS-ERP�·�����-test", mailBody, "*****@*****.**", mailTo, mailCc, true, false, attachmentFiles, null);

                    break;
                default:
                    break;
            }
        }