Ejemplo n.º 1
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public void ExportExcel(IList<PJ_clcrkd> datalist)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\生产台账.xls";
     ex.Open(fname);
     ExportExcel(ex, datalist, "生产物资管理生产台账");
     
     ex.DeleteSheet(1);
     ex.ShowExcel();
    
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public void ExportExcelProjectCKD(string orgid, string strProject, string strfenProject)
        {
            ////lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\出库单.xls";
            ex.Open(fname);
            bool isadd = false;
            string strfirst = "";
            string filter = "";
            string filter2 = "";
            string filter3 = "";
            string filter4 = "";
            if (strProject != "全部")
                filter2 = "  where 1=1 and ssgc='" + strProject + "'  and type = '撤旧材料出库单' ";
            else
                filter2 = "  where 1=1  and type = '撤旧材料出库单' ";

            IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct ssgc  from PJ_clcrkd " + filter2 + " order by ssgc");

            foreach (string mc in mclist)
            {
                if (strfenProject == "全部")
                    filter3 = "  where 1=1 and type = '撤旧材料出库单' ";
                else
                    filter3 = "  where  ssxm='" + strfenProject + "'  and type = '撤旧材料出库单' ";

                IList xmlist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct ssxm  from PJ_clcrkd " + filter3 + " order by ssxm");
                foreach (string xm in xmlist)
                {
                    filter4 = "  where 1=1 and type = '撤旧材料出库单'"
                        + "  and ssgc='" + mc + "' "
                        + "  and ssxm='" + xm + "' ";
                    //IList sjlist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct CONVERT(varchar(50) ,indate, 112 )  from PJ_clcrkd " + filter4 + " ");

                    IList sjlist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct num  from PJ_clcrkd " + filter4 + " ");
                    foreach (string sj in sjlist)
                    {
                        filter = "  where 1=1 and type = '撤旧材料出库单'"
                        + "  and ssgc='" + mc + "' "
                        + "  and ssxm='" + xm
                        + "' and num= '" + sj + "' ";
                        if (isWorkflowCall)
                        {

                            filter = filter + " and id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where  WorkFlowId='"
                                + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "') "
                                    + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                                + "    RecordID='" + currRecord.ID + "') "
                                ;
                        }

                        IList<PJ_clcrkd> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_clcrkd>(
                         filter
                           );
                        if (datalist.Count > 0) isadd = true;
                        ExportExcel(ex, datalist);
                    }
                }

            }


            if (isadd)
            ex.DeleteSheet(1);
            ex.ShowExcel();
        }
Ejemplo n.º 3
0
        public void ExportExcelProjectCKD(string orgid, string strnum)
        {
            ////lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\局安全工器具入库单.xls";
            ex.Open(fname);
            string filter = "";
            if (strnum != "全部")
                filter = "  where 1=1 and num='" + strnum + "'  and type = '局安全工器具入库单' ";
            else
                filter = "  where 1=1  and type = '局安全工器具入库单' ";
            if (isWorkflowCall)
            {

                filter = filter + " and id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where  WorkFlowId='"
                    + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "') "
                        + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                    + "    RecordID='" + currRecord.ID + "') "
                    ;
            }
            IList<PJ_anqgjcrkd> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_anqgjcrkd>(
                          filter
                            );
           ExportExcel(ex, datalist);

           try
           {
               ex.DeleteSheet(1);
           }
           catch { }
            ex.ShowExcel();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public  void ExportExcel(string orgid)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\线路设备责任区划分明白表.xls";
     ex.Open(fname);
     string sdtrorg=" ";
     if (orgid != "")
     {
         
         sdtrorg += "  and OrgCode='" + orgid + "'";
     }
     bool iszero = true;
     IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct zrr  from PJ_xlsbzrqhfmbb where  1=1 " + sdtrorg);
     foreach (string mc in mclist)
     {
         string str = " where 1=1 and zrr='"+mc+"' ";
         if (orgid != "")
         {
             str += "  and OrgCode='" + orgid + "' ";
         }
         if (isWorkflowCall)
         {
             str = str + " and ( id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                 + "    RecordID='" + currRecord.ID + "')) "
                 ;
         }
         IList<PJ_xlsbzrqhfmbb> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_xlsbzrqhfmbb>(
            str
             );
         if (datalist.Count > 0)
         {
             iszero = false;
             ExportExcel(ex, datalist, mc);
         }
     }
     if (!iszero) ex.DeleteSheet(1);
     ex.ShowExcel();
    
 }
Ejemplo n.º 5
0
        public void ExportExcelSubmit(ref LP_Temple parentTemple,  string orgid, bool isShow)
        {
            DSOFramerControl dsoFramerWordControl1 = new DSOFramerControl();
            string fname = Application.StartupPath + "\\00记录模板\\线路设备责任区划分明白表.xls";
            dsoFramerWordControl1.FileOpen(fname);
            
        
            if (parentTemple == null)
            {
                parentTemple = new LP_Temple();
                parentTemple.Status = "文档生成";
            }
            parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip;
            dsoFramerWordControl1.FileSave();
            dsoFramerWordControl1.FileClose();
            dsoFramerWordControl1.FileDataGzip = parentTemple.DocContent;
            ExcelAccess ex = new ExcelAccess();
            Microsoft.Office.Interop.Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook;
            ex.MyWorkBook = wb;
            ex.MyExcel = wb.Application;
           string filter = "";
            int i = 0;


            string sdtrorg = " ";
            if (orgid != "")
            {

                sdtrorg += "  and OrgCode='" + orgid + "'";
            }
            IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct zrr  from PJ_xlsbzrqhfmbb where  1=1 " + sdtrorg);
            List<WF_ModleRecordWorkTaskIns> mrwtlist = new List<WF_ModleRecordWorkTaskIns>();
            foreach (string mc in mclist)
            {
                filter = " where 1=1 and zrr='" + mc + "' ";
                if (orgid != "") filter = " and OrgCode='" + orgid + "'";
                if (isWorkflowCall)
                {
                    filter = filter + " and (id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where  WorkFlowInsId='"
                        + WorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "') "
                            + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                        + "    RecordID='" + currRecord.ID + "')) "
                        ;
                }

                IList<PJ_xlsbzrqhfmbb> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_xlsbzrqhfmbb>(
                     filter
                     );
                ExportExcel(ex, datalist,mc);
            }
            ex.DeleteSheet(1);
            if (parentTemple == null)
            {
                parentTemple = new LP_Temple();
                parentTemple.Status = "文档生成";
            }
            dsoFramerWordControl1.FileSave();
            parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip;
            dsoFramerWordControl1.FileSave();
            dsoFramerWordControl1.FileClose();
        }
Ejemplo n.º 6
0
        public void ExportExcelProjectCKD(string orgid, string strProject, string strfenProject)
        {
            ////lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\验收单.xls";
            ex.Open(fname);
            string strfirst = "";
            string filter = "";
            string filter2 = "";
            string filter3 = "";
            string filter4 = "";
            if (strProject != "全部")
                filter2 = "  where 1=1 and ssgc='" + strProject + "'  ";
            else
                filter2 = "  where 1=1  ";

            IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct ssgc  from PJ_wgclrkysd " + filter2 + " order by ssgc");
            
            foreach (string mc in mclist)
            {
                if (strfenProject == "全部")
                    filter3 = "  where 1=1 ";
                else
                    filter3 = "  where  ssxm='" + strfenProject + "'  ";

                IList xmlist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct ssxm  from PJ_wgclrkysd " + filter3 + " order by ssxm");
                foreach (string xm in xmlist)
                {
                    filter4 = "  where 1=1"
                        + "  and ssgc='" + mc + "' "
                        +"  and ssxm='" + xm + "' ";
                    IList sjlist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct dhht  from PJ_wgclrkysd " + filter4 + " ");
                    foreach (string sj in sjlist)
                    {
                        filter = "  where 1=1"
                        + "  and ssgc='" + mc + "' "
                        + "  and ssxm='" + xm
                        + "' and  dhht='" + sj + "' ";
                        if (isWorkflowCall)
                        {
                          
                            filter = filter + " and id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where  WorkFlowId='"
                                + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "') "
                                    + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                                + "    RecordID='" + currRecord.ID + "') "
                                ;
                        }

                        IList<PJ_wgclrkysd> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_wgclrkysd>(
                         filter
                           );
                        ExportExcel(ex, datalist);
                    }
                }

            }

            try
            {
                ex.DeleteSheet(1);
            }
            catch { }
            ex.ShowExcel();
        }