Bladeren bron

新增上传完报价

zhuyiyi 1 week geleden
bovenliggende
commit
fdf9f65b4c
3 gewijzigde bestanden met toevoegingen van 47 en 7 verwijderingen
  1. 1 0
      Global.asax
  2. 4 3
      copydownload.aspx.cs
  3. 42 4
      uploadFile.aspx.cs

+ 1 - 0
Global.asax

@@ -31,6 +31,7 @@
                                  typeof(CeErpTradeCell),
                                  typeof(XLog),
                                  typeof(CeErpTradeLog),
+                                 typeof(CeErpProduct),
                                  typeof(CeErpDataSendOrderInfo),
 
                              };

+ 4 - 3
copydownload.aspx.cs

@@ -344,9 +344,10 @@ public partial class copydownload : System.Web.UI.Page
 
     private string getDesignDate(object v)
     {
-        return DateTime.Now.ToString("yyyy-MM-dd");
-        if (v.ToString() == "") return "";
-        return Convert.ToDateTime(v).ToString("yyyy-MM-dd");
+        int year = DateTime.Now.Year;
+        int month = DateTime.Now.Month;
+        int day = DateTime.Now.Day;
+        return year + "\\" + month + "\\" + day;
     }
 
     ///  批量进行多个文件压缩到一个文件

+ 42 - 4
uploadFile.aspx.cs

@@ -19,6 +19,9 @@ using System.Security.Principal;
 using System.Threading.Tasks;
 using System.Data;
 using System.Text.RegularExpressions;
+using MSharp.Framework;
+using System.Net.Http.Headers;
+using System.Net.Http;
 
 public partial class uploadFile : System.Web.UI.Page
 {
@@ -76,7 +79,6 @@ public partial class uploadFile : System.Web.UI.Page
         //    return;
         //}
         //CeErpTradeCell.GetByCtid("1717009344450030601");
-
         if (Request.Files.Count < 1)
         {
             conErc("空文件!");
@@ -102,7 +104,7 @@ public partial class uploadFile : System.Web.UI.Page
             MatchCollection nameMatches = nameReg.Matches(file_name);//设定要查找的字符串
             if (nameMatches.Count > 0)
             {
-                foreach (System.Text.RegularExpressions.Match match in nameMatches)
+                foreach (Match match in nameMatches)
                 {
                     file_name = file_name.Replace(match.Value, "");
                 }
@@ -264,7 +266,8 @@ public partial class uploadFile : System.Web.UI.Page
                         }
 
                     }
-                    if (!entity.seller_memo.Contains("出货"))
+                    string patterns = "出货|加急|顺丰|打印|专版|当天发";
+                    if (!Regex.IsMatch(entity.seller_memo, patterns) && string.IsNullOrEmpty(entity.OtherMemo) && !entity.ctid.Contains("S_"))
                     {
                         if (entity.payment <= 300 && num >= 200 && num <= 3000 && entity.ShopId != 14 && entity.ShopId != 99)
                         {
@@ -420,7 +423,9 @@ public partial class uploadFile : System.Web.UI.Page
                     entity.Update();
                     //CeErpTradeCell.UpdateRelationOrder(entity);
                     CeErpTradeCell.UpdateRelationOrder(entity.ctid);
-
+                    CeErpProduct product = CeErpProduct.GetById(entity.ProductId);
+                    string param = "[{ \"product_type\": \"" + product.PType + "\",        \"remark\": \"" + entity.seller_memo + "\"    }]";
+                    sysHttpClient(param);
                     CeErpTradeLog.AddLog(entity.ctid, entity.OrderState, userId, "上传设计文件-" + saveFile);
                     if (ctid.IndexOf("S_") >= -1)
                     {
@@ -622,8 +627,41 @@ public partial class uploadFile : System.Web.UI.Page
 
     }
 
+    public void sysHttpClient(string param)
+    {
+        Task.Run(async () =>
+        {
+            var client = new HttpClient();
+            var request = new HttpRequestMessage
+            {
+                Method = HttpMethod.Post,
+                RequestUri = new Uri("http://47.122.57.102:11004/quotations/batch"),
+                Content = new StringContent(param)
+                {
+                    Headers =
+                    {
+                        ContentType = new MediaTypeHeaderValue("application/json")
+                    }
+                }
+            };
+            var task = Task.Run(() =>
+            {
+                try
+                {
+                    var response = client.SendAsync(request).Result;
+                    response.EnsureSuccessStatusCode();
+                    return response.Content.ReadAsStringAsync().Result;
+                }
+                catch (Exception e)
+                {
+                    return "";
+                }
 
 
+            });
+        });
+    }
+
     private void Decompress(string GzipFile, string targetPath)
     {
         //string directoryName = Path.GetDirectoryName(targetPath + "\\") + "\\";