新增上传文件通知报价
This commit is contained in:
+69
-1
@@ -1,5 +1,6 @@
|
|||||||
using BizCom;
|
using BizCom;
|
||||||
using ICSharpCode.SharpZipLib.Zip;
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
|
using MSharp.Framework;
|
||||||
using SQLData;
|
using SQLData;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -7,7 +8,10 @@ using System.Configuration;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
@@ -64,7 +68,7 @@ public partial class autocopy : System.Web.UI.Page
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StringBuilder sqlnew = new StringBuilder();
|
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];
|
DataTable dtnew = CeErpTradeCell.ExecuteDataset(sqlnew.ToString()).Tables[0];
|
||||||
if (dtnew == null || dtnew.Rows.Count < 1)
|
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);
|
//string sqlpng = string.Format("insert into s_cdrtopng(name,addtime)values('{0}',getdate()) ;", newPathFileName);
|
||||||
//CeErpTradeLog.ExecuteNonQuery(sqlpng);
|
//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);
|
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"]);
|
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);
|
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)
|
public static string MidStrEx(string sourse, string startstr, string endstr)
|
||||||
{
|
{
|
||||||
string result = string.Empty;
|
string result = string.Empty;
|
||||||
@@ -360,5 +410,23 @@ public partial class autocopy : System.Web.UI.Page
|
|||||||
Response.Flush();
|
Response.Flush();
|
||||||
Response.End();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-2
@@ -79,6 +79,7 @@ public partial class uploadFile : System.Web.UI.Page
|
|||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
//CeErpTradeCell.GetByCtid("1717009344450030601");
|
//CeErpTradeCell.GetByCtid("1717009344450030601");
|
||||||
|
|
||||||
if (Request.Files.Count < 1)
|
if (Request.Files.Count < 1)
|
||||||
{
|
{
|
||||||
conErc("空文件!");
|
conErc("空文件!");
|
||||||
@@ -424,8 +425,11 @@ public partial class uploadFile : System.Web.UI.Page
|
|||||||
//CeErpTradeCell.UpdateRelationOrder(entity);
|
//CeErpTradeCell.UpdateRelationOrder(entity);
|
||||||
CeErpTradeCell.UpdateRelationOrder(entity.ctid);
|
CeErpTradeCell.UpdateRelationOrder(entity.ctid);
|
||||||
CeErpProduct product = CeErpProduct.GetById(entity.ProductId);
|
CeErpProduct product = CeErpProduct.GetById(entity.ProductId);
|
||||||
string param = "[{ \"product_type\": \"" + product.PType + "\", \"remark\": \"" + entity.seller_memo + "\" }]";
|
if (product != null)
|
||||||
sysHttpClient(param);
|
{
|
||||||
|
string param = "[{ \"product_type\": \"" + product.PType + "\",\"remark\": \"" + entity.seller_memo + "\",\"index\": \"" + entity.OrderSn + "\",\"orderid\": \"" + entity.ctid + "\",\"price\": \"" + entity.payment + "\"}]";
|
||||||
|
sysHttpClient(param);
|
||||||
|
}
|
||||||
CeErpTradeLog.AddLog(entity.ctid, entity.OrderState, userId, "上传设计文件-" + saveFile);
|
CeErpTradeLog.AddLog(entity.ctid, entity.OrderState, userId, "上传设计文件-" + saveFile);
|
||||||
if (ctid.IndexOf("S_") >= -1)
|
if (ctid.IndexOf("S_") >= -1)
|
||||||
{
|
{
|
||||||
@@ -650,6 +654,7 @@ public partial class uploadFile : System.Web.UI.Page
|
|||||||
{
|
{
|
||||||
var response = client.SendAsync(request).Result;
|
var response = client.SendAsync(request).Result;
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
writeLog(param + "-" + response.Content.ReadAsStringAsync().Result);
|
||||||
return response.Content.ReadAsStringAsync().Result;
|
return response.Content.ReadAsStringAsync().Result;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
Reference in New Issue
Block a user