Selaa lähdekoodia

修改导出excel

zhuyiyi 1 päivä sitten
vanhempi
sitoutus
a24d597cb6
3 muutettua tiedostoa jossa 44 lisäystä ja 34 poistoa
  1. 0 4
      SiteCore/Handler/sync.order.cs
  2. 41 27
      Web/Reports/comExports.aspx.cs
  3. 3 3
      ecomServer/MainForm.cs

+ 0 - 4
SiteCore/Handler/sync.order.cs

@@ -13079,10 +13079,6 @@ namespace SiteCore.Handler
                         if (DateTime.Compare(FinishPlaceTime, three) < 0)
                         {
                             map["dayDev"]++;
-                            if (supplierId == 80 && istoday)
-                            {
-                                Debug.WriteLine(seller_memo);
-                            }
                         }
                     }
                     // QC---121

+ 41 - 27
Web/Reports/comExports.aspx.cs

@@ -237,33 +237,47 @@ public partial class Reports_comExports : ReportBaseX
 
     public void DownLoadFile_Ex()
     {
-        using (NpoiMemoryStream ms = new NpoiMemoryStream())
-        {
-            ms.AllowClose = false;
-            xssfworkbook.Write(ms);
-            ms.Flush();
-            ms.Seek(0, SeekOrigin.Begin);
-            ms.AllowClose = true;
-            //xssfworkbook.Write(ms);
-            Response.Clear();
-            Response.Buffer = true;
-            Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
-            Response.Expires = 0;
-            Response.AddHeader("pragma", "no-cache");
-            Response.AddHeader("cache-control", "private");
-            Response.CacheControl = "no-cache";
-            //Response.Charset = "GB2312";
-            Response.Charset = "UTF-8";
-            //Response.AppendHeader("Content-Disposition", "attachment;filename=" + excelName + ".xls");
-            Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(excelName + ".xlsx", System.Text.Encoding.UTF8));
-            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
-            //Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
-            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
-            ms.WriteTo(Response.OutputStream);
-            //Response.Flush();
-            xssfworkbook.Close();
-            xssfworkbook = null;
-            iSheet = null;
+        try
+        {
+            using (NpoiMemoryStream ms = new NpoiMemoryStream())
+            {
+                ms.AllowClose = false;
+                xssfworkbook.Write(ms);
+                ms.Flush();
+                ms.Seek(0, SeekOrigin.Begin);
+                ms.AllowClose = true;
+                //xssfworkbook.Write(ms);
+                Response.Clear();
+                Response.Buffer = true;
+                Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
+                Response.Expires = 0;
+                Response.AddHeader("pragma", "no-cache");
+                Response.AddHeader("cache-control", "private");
+                Response.CacheControl = "no-cache";
+                //Response.Charset = "GB2312";
+                Response.Charset = "UTF-8";
+                //Response.AppendHeader("Content-Disposition", "attachment;filename=" + excelName + ".xls");
+                Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(excelName + ".xlsx", System.Text.Encoding.UTF8));
+                Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
+                                                                                      //Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
+                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                ms.WriteTo(Response.OutputStream);
+                //Response.Flush();
+            }
+        }
+        catch (Exception ex)
+        {
+
+        }
+        finally
+        {
+            if (xssfworkbook != null)
+            {
+                xssfworkbook.Close();
+                xssfworkbook.Dispose();
+                xssfworkbook = null;
+                iSheet = null;
+            }
         }
 
         //Response.End();

+ 3 - 3
ecomServer/MainForm.cs

@@ -364,12 +364,12 @@ namespace ErpServer
                                                     isAll = false;
                                                 }
                                             }
-                                            sql = "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0,FinishDeliveryTime = GETDATE()  where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag='' and isAfterSaleOrder=0 ;";
-                                            sql += "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0,FinishDeliveryTime = GETDATE()  where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag!='' and OrderState>6 and isAfterSaleOrder=0 ;";
+                                            sql = "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0,FinishDeliveryTime = case when FinishDeliveryTime is null then GETDATE() else FinishDeliveryTime END where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag='' and isAfterSaleOrder=0 ;";
+                                            sql += "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0,FinishDeliveryTime = case when FinishDeliveryTime is null then GETDATE() else FinishDeliveryTime END where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and SplitTag!='' and OrderState>6 and isAfterSaleOrder=0 ;";
 
                                             if (isAll)
                                             {
-                                                sql = "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0  where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and isAfterSaleOrder=0 ;";
+                                                sql = "update CE_ErpTradeCell WITH(ROWLOCK) set OrderState=" + dr["orderstate"] + ",IsUrgency=0,isReturn=0, FinishDeliveryTime = case when FinishDeliveryTime is null then GETDATE() else FinishDeliveryTime END where tid='" + dr["ctid"] + "' and IsPreDelivery=0  and isAfterSaleOrder=0 ;";
                                             }
                                             SqlHelper.ExecuteNonQuery(sql);
                                             break;