duhongyu 4 lat temu
rodzic
commit
27aaced279

Plik diff jest za duży
+ 14 - 4
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs


+ 61 - 35
CallCenterCommon/CallCenter.Utility/word/ExportWord.cs

@@ -16,13 +16,14 @@ public class ExportWord
16 16
             Object Nothing = System.Reflection.Missing.Value;
17 17
             Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();
18 18
               Microsoft.Office.Interop.Word.Document WordDoc = WordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);
19
-              WordApp.Selection.PageSetup.LeftMargin = 50f;
20
-              WordApp.Selection.PageSetup.RightMargin = 50f;
21
-              WordApp.Selection.PageSetup.PageWidth = 650f;  //页面宽度 
19
+        //设置纸张为A4纸大小
20
+        WordDoc.PageSetup.PaperSize = MSWord.WdPaperSize.wdPaperA4;
22 21
               WordDoc.ActiveWindow.Selection.Font.Bold = 2;
23
-             WordApp.Selection.ParagraphFormat.LineSpacing = 13f;//设置文档的行间距      
24
-              //移动焦点并换行 
25
-             object count = 14;
22
+             WordApp.Selection.ParagraphFormat.LineSpacing = 13f;//设置文档的行间距     
23
+        WordDoc.PageSetup.LeftMargin = 45f;
24
+        WordDoc.PageSetup.RightMargin  = 45f;
25
+        //移动焦点并换行 
26
+        object count = 14;
26 27
               object WdLine = Microsoft.Office.Interop.Word.WdUnits.wdLine;//换一行;
27 28
              WordApp.Selection.ParagraphFormat.LineSpacing = 18f;
28 29
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
@@ -30,6 +31,7 @@ public class ExportWord
30 31
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
31 32
               WordApp.Selection.TypeParagraph();//插入段落 
32 33
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
34
+              WordApp.Selection.Font.Name = "小四";
33 35
               WordApp.Selection.Font.Size = 18f;
34 36
               object missing = System.Reflection.Missing.Value;
35 37
               object WdLine2 = Microsoft.Office.Interop.Word.WdUnits.wdLine;//换一行;   
@@ -39,28 +41,36 @@ public class ExportWord
39 41
               WordApp.Selection.MoveDown(ref WdLine, ref count, ref Nothing);//移动焦点 
40 42
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
41 43
               WordApp.Selection.TypeParagraph();//插入段落 
42
-              WordApp.Selection.Font.Size = 10.5f;
44
+              WordApp.Selection.Font.Size = 11f;
43 45
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
44 46
               WordApp.Selection.Font.Color = Microsoft.Office.Interop.Word.WdColor.wdColorBlack;
45 47
               //文档中创建表格 
46
-             Microsoft.Office.Interop.Word.Table newTable = WordDoc.Tables.Add(WordApp.Selection.Range, 18, 9, ref Nothing, ref Nothing);
48
+             Microsoft.Office.Interop.Word.Table newTable = WordDoc.Tables.Add(WordApp.Selection.Range, 18, 8, ref Nothing, ref Nothing);
47 49
              //设置表格样式 
48
-            for (int i = 1; i < 10; i ++)
50
+            for (int i = 1; i < 9; i ++)
49 51
             {
50 52
             if (i ==2)
51 53
             {
52
-                newTable.Columns[i].Width = 70f;
54
+                newTable.Columns[i].Width = 75f;
53 55
             }
54
-            else  if (i ==9)
56
+            else  if (i ==8)
55 57
             {
56 58
                 newTable.Columns[i].Width = 80f;
57 59
             }
60
+            else if (i ==4)
61
+            {
62
+                newTable.Columns[i].Width = 65f;
63
+            }
64
+            else if (i == 6)
65
+            {
66
+                newTable.Columns[i].Width = 65f;
67
+            }
58 68
             else  
59 69
             newTable.Columns[i].Width = 60f;
60 70
             }
61 71
             for (int i=1;i<19;i++)
62 72
            {
63
-            newTable.Rows[i].Height = 35f;
73
+            newTable.Rows[i].Height = 32f;
64 74
            }
65 75
         string user = "";
66 76
           if (jbdata.Rows.Count > 0)
@@ -77,11 +87,12 @@ public class ExportWord
77 87
              newTable.Cell(1, 1).Range.Text = "事项编号";
78 88
              newTable.Cell(1, 1).Merge(newTable.Cell(2, 1));
79 89
              newTable.Cell(1, 2).Range.Text = dt.Rows[0]["F_WorkOrderId"].ToString();
80
-             newTable.Cell(1, 2).Merge(newTable.Cell(2, 3));
90
+        newTable.Cell(1, 2).Range.Font.Bold  = 0;
91
+        newTable.Cell(1, 2).Merge(newTable.Cell(2, 2));
81 92
              newTable.Cell(1, 3).Range.Text = "工单来源";
82 93
              newTable.Cell(1, 4).Range.Text = dt.Rows[0]["SourceName"].ToString();
83
-       
84
-             newTable.Cell(1, 5).Range.Text = "办理时限";
94
+        newTable.Cell(1, 4).Range.Font.Bold = 0;
95
+        newTable.Cell(1, 5).Range.Text = "办理时限";
85 96
         if (jbdata.Rows.Count > 0)
86 97
         {
87 98
             if (jbdata.Rows[0]["F_LimitTime"]!=null && jbdata.Rows[0]["F_LimitTime"].ToString()!="")
@@ -92,29 +103,36 @@ public class ExportWord
92 103
            
93 104
         else
94 105
             newTable.Cell(1, 6).Range.Text = "";
95
-            newTable.Cell(1, 7).Range.Text = "联系电话";
106
+        newTable.Cell(1, 6).Range.Font.Bold = 0;
107
+        newTable.Cell(1, 7).Range.Text = "联系电话";
96 108
            newTable.Cell(1, 8).Range.Text = dt.Rows[0]["F_CusPhone"].ToString();
97
-             newTable.Cell(2, 3).Range.Text = "签收时间";
109
+        newTable.Cell(1, 8).Range.Font.Bold = 0;
110
+        newTable.Cell(2, 3).Range.Text = "签收时间";
98 111
         if (jbdata.Rows.Count > 0)
99 112
         {
100 113
             if (jbdata.Rows[0]["F_SureTime"] != null && jbdata.Rows[0]["F_SureTime"].ToString() != "")
101 114
                 newTable.Cell(2, 4).Range.Text = DateTime.Parse(jbdata.Rows[0]["F_SureTime"].ToString()).ToString("yyyy-MM-dd");
102 115
             else
103 116
                 newTable.Cell(2, 4).Range.Text = "";
117
+            
104 118
         }
105 119
         else
106 120
             newTable.Cell(2, 4).Range.Text = "";
107
-           newTable.Cell(2, 5).Range.Text = "办理时间";
121
+        newTable.Cell(2, 4).Range.Font.Bold = 0;
122
+        newTable.Cell(2, 5).Range.Text = "办理时间";
108 123
         if (dt.Rows[0]["F_CreateTime"] != null && dt.Rows[0]["F_CreateTime"].ToString() != "")
109 124
             newTable.Cell(2, 6).Range.Text = DateTime.Parse(dt.Rows[0]["F_CreateTime"].ToString()).ToString("yyyy-MM-dd");
110 125
         else  
111 126
         newTable.Cell(2, 6).Range.Text = dt.Rows[0]["F_CreateTime"].ToString();
127
+        newTable.Cell(2, 6).Range.Font.Bold = 0;
112 128
         newTable.Cell(2, 7).Range.Text = "来电人";
113 129
         newTable.Cell(2, 8).Range.Text = dt.Rows[0]["F_CusName"].ToString();
130
+        newTable.Cell(2,8).Range.Font.Bold = 0;
114 131
         newTable.Cell(3, 1).Range.Text = "事项区域";
115
-            newTable.Cell(3, 2).Range.Text = dt.Rows[0]["F_SourceAddress"].ToString();
116
-        newTable.Cell(3, 2).Merge(newTable.Cell(3, 9));
117
-            newTable.Cell(4, 1).Range.Text = "内容摘要";
132
+        newTable.Cell(3, 2).Range.Text = dt.Rows[0]["F_SourceAddress"].ToString();
133
+        newTable.Cell(3, 2).Merge(newTable.Cell(3, 8));
134
+        newTable.Cell(3, 2).Range.Font.Bold = 0;
135
+        newTable.Cell(4, 1).Range.Text = "内容摘要";
118 136
             newTable.Cell(4, 1).Merge(newTable.Cell(7, 1));
119 137
         if (dt.Rows[0]["F_Content"] != null && dt.Rows[0]["F_Content"].ToString() != "")
120 138
         {
@@ -124,45 +142,53 @@ public class ExportWord
124 142
         {
125 143
             newTable.Cell(4, 2).Range.Text = dt.Rows[0]["F_ComContent"].ToString();
126 144
         }
127
-        newTable.Cell(4, 2).Merge(newTable.Cell(7, 9));
128
-        newTable.Cell(4, 1).Height = 120f;
129
-        newTable.Cell(4, 2).Height = 120f;
145
+        newTable.Cell(4, 2).Merge(newTable.Cell(7, 8));
146
+        newTable.Cell(4, 2).Range.Font.Bold = 0;
147
+        newTable.Cell(4, 1).Height = 130f;
148
+        newTable.Cell(4, 2).Height = 130f;
130 149
         newTable.Cell(5, 1).Range.Text = "承办单位";
131 150
         if (jbdata.Rows.Count > 0)
132 151
             newTable.Cell(5, 2).Range.Text = jbdata.Rows[0]["DeptName"].ToString();
133 152
         newTable.Cell(5, 2).Merge(newTable.Cell(5, 4));
134
-           newTable.Cell(5, 3).Range.Text = "协办单位";
153
+        newTable.Cell(5, 2).Range.Font.Bold = 0;
154
+        newTable.Cell(5, 3).Range.Text = "协办单位";
135 155
         if (jbdata.Rows.Count > 0)
136 156
             newTable.Cell(5, 4).Range.Text = jbdata.Rows[0]["OtherDeptName"].ToString();
137
-        newTable.Cell(5, 4).Merge(newTable.Cell(5, 7));
157
+        newTable.Cell(5, 4).Merge(newTable.Cell(5, 6));
158
+        newTable.Cell(5, 4).Range.Font.Bold = 0;
138 159
         newTable.Cell(6, 1).Range.Text = "调度意见";
139 160
         newTable.Cell(6, 1).Merge(newTable.Cell(8, 1));
140 161
         if (jbdata.Rows.Count > 0)
141 162
             newTable.Cell(6, 2).Range.Text = jbdata.Rows[0]["F_AssignedOpinion"].ToString();
142
-        newTable.Cell(6, 2).Merge(newTable.Cell(8, 9));
163
+        newTable.Cell(6, 2).Merge(newTable.Cell(8, 8));
164
+        newTable.Cell(6, 2).Range.Font.Bold = 0;
143 165
         newTable.Cell(6, 1).Height = 90f;
144 166
         newTable.Cell(6, 2).Height = 90f;
145 167
         newTable.Cell(7, 1).Range.Text = "承办意见";
146 168
         newTable.Cell(7, 1).Merge(newTable.Cell(8, 1));
147 169
         newTable.Cell(7, 2).Range.Text = "  ";
148
-        newTable.Cell(7, 2).Merge(newTable.Cell(8, 9));
170
+        newTable.Cell(7, 2).Merge(newTable.Cell(8, 8));
171
+        newTable.Cell(7, 1).Height = 50f;
172
+        newTable.Cell(7, 2).Height = 50f;
149 173
         newTable.Cell(8, 1).Range.Text = "领导批示";
150 174
         newTable.Cell(8, 1).Merge(newTable.Cell(9, 1));
151 175
         newTable.Cell(8, 2).Range.Text = "";
152
-        newTable.Cell(8, 2).Merge(newTable.Cell(9, 9));
176
+        newTable.Cell(8, 2).Merge(newTable.Cell(9, 8));
177
+        newTable.Cell(8, 1).Height = 50f;
178
+        newTable.Cell(8, 2).Height = 50f;
153 179
         newTable.Cell(9, 1).Range.Text = "处理结果";
154 180
         newTable.Cell(9, 1).Merge(newTable.Cell(12, 1));
155 181
         newTable.Cell(9, 2).Range.Text = dt.Rows[0]["F_Result"].ToString();
156
-        newTable.Cell(9, 2).Merge(newTable.Cell(12, 9));
157
-        newTable.Cell(9, 1).Height = 120f;
158
-        newTable.Cell(9, 2).Height = 120f;
182
+        newTable.Cell(9, 2).Merge(newTable.Cell(12, 8));
183
+        newTable.Cell(9, 2).Range.Font.Bold = 0;
184
+        newTable.Cell(9, 1).Height = 140f;
185
+        newTable.Cell(9, 2).Height = 140f;
159 186
         WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
160 187
         object unite = MSWord.WdUnits.wdStory;
161 188
 
162 189
         WordApp.Selection.EndKey(ref unite, ref Nothing); //将光标移动到文档末尾
163 190
 
164
-        WordDoc.Content.InsertAfter("联系电话:" + "(0372)12345" + "                        "
165
-        + "    审核员:" + usercode + "                   " + "       调度员:" + user);
191
+        WordDoc.Content.InsertAfter("联系电话:" + "(0372)12345"+ "                " + "审核员:" + usercode + "         " + "       调度员:" + user);
166 192
         string FileName = "/Upload/Word/" + "/word.png";
167 193
         FileName = HttpContext.Current.Server.MapPath("..") + FileName;
168 194
         newTable.Cell(6, 2).Select();//选中一行 
@@ -173,7 +199,7 @@ public class ExportWord
173 199
         WordDoc.Application.ActiveDocument.InlineShapes.AddPicture(FileName, ref LinkToFile, ref SaveWithDocument, ref Anchor);
174 200
        WordDoc.Application.ActiveDocument.InlineShapes[1].Width = 120f;//图片宽度 
175 201
        WordDoc.Application.ActiveDocument.InlineShapes[1].Height =120f;//图片高 
176
-        WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape().IncrementLeft(380.0f);//图片位置
202
+        WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape().IncrementLeft(300.0f);//图片位置
177 203
        // WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape().WrapFormat.Type = Microsoft.Office.Interop.Word.WdWrapType.wdWrapBehind;
178 204
 
179 205