新增上传文件通知报价
This commit is contained in:
+69
-1
@@ -1,5 +1,6 @@
|
||||
using BizCom;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using MSharp.Framework;
|
||||
using SQLData;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,7 +8,10 @@ using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
@@ -64,7 +68,7 @@ public partial class autocopy : System.Web.UI.Page
|
||||
return;
|
||||
}
|
||||
StringBuilder sqlnew = new StringBuilder();
|
||||
sqlnew.AppendFormat("select ctid,tid,seller_memo,FinishDesignTime,OrderState,SupplierId,SupplierName,orderSn from view_erptradecell where (orderstate=3 or orderstate=4) and ctid='{0}'", newctid);
|
||||
sqlnew.AppendFormat("select ctid,tid,seller_memo,FinishDesignTime,OrderState,SupplierId,SupplierName,orderSn,payment,ProductId from view_erptradecell where (orderstate=3 or orderstate=4) and ctid='{0}'", newctid);
|
||||
DataTable dtnew = CeErpTradeCell.ExecuteDataset(sqlnew.ToString()).Tables[0];
|
||||
if (dtnew == null || dtnew.Rows.Count < 1)
|
||||
{
|
||||
@@ -203,6 +207,15 @@ public partial class autocopy : System.Web.UI.Page
|
||||
//string sqlpng = string.Format("insert into s_cdrtopng(name,addtime)values('{0}',getdate()) ;", newPathFileName);
|
||||
//CeErpTradeLog.ExecuteNonQuery(sqlpng);
|
||||
}
|
||||
if (!Convert.IsDBNull(newDr["ProductId"]))
|
||||
{
|
||||
CeErpProduct product = CeErpProduct.GetById(Convert.ToInt32(newDr["ProductId"]));
|
||||
if (product != null)
|
||||
{
|
||||
string param = "[{ \"product_type\": \"" + product.PType + "\",\"remark\": \"" + newDr["seller_memo"] + "\",\"index\": \"" + orderSn + "\",\"orderid\": \"" + newDr["ctid"] + "\",\"price\": \"" + newDr["payment"] + "\"}]";
|
||||
sysHttpClient(param);
|
||||
}
|
||||
}
|
||||
CeErpTradeLog.AddLog(newctid, 5, userId, "自动上传老客户文件-" + newPathFileName);
|
||||
string fileSql = string.Format("INSERT INTO [dbo].[CE_ErpTradeCellFile]([tid], [ctid], [isDel], [url], [createtime], [type]) SELECT '{0}', '{1}', isDel ,url,getdate(),type FROM [dbo].[CE_ErpTradeCellFile] WHERE tid='{2}' and ctid='{3}' and isDel = 0 and type = 'AUTH_FILE'", dtnew.Rows[0]["tid"], dtnew.Rows[0]["tid"], dt.Rows[0]["tid"], dt.Rows[0]["tid"]);
|
||||
CeErpTradeCell.ExecuteNonQuery(fileSql);
|
||||
@@ -218,6 +231,43 @@ public partial class autocopy : 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();
|
||||
writeLog(param + "-" + response.Content.ReadAsStringAsync().Result);
|
||||
return response.Content.ReadAsStringAsync().Result;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static string MidStrEx(string sourse, string startstr, string endstr)
|
||||
{
|
||||
string result = string.Empty;
|
||||
@@ -360,5 +410,23 @@ public partial class autocopy : System.Web.UI.Page
|
||||
Response.Flush();
|
||||
Response.End();
|
||||
}
|
||||
|
||||
|
||||
private static string logPath = ConfigurationManager.AppSettings["curPath"] + "\\log";
|
||||
private static object logFlag = new object();
|
||||
public static void writeLog(string log)
|
||||
{
|
||||
lock (logFlag)
|
||||
{
|
||||
using (FileStream fileStream = new FileStream(logPath + "\\" + DateTime.Now.ToString("yy-MM-dd") + ".log", FileMode.Append, FileAccess.Write))
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(fileStream, Encoding.Default))
|
||||
{
|
||||
sw.Write(log + " ------时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n");
|
||||
sw.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user