using BizCom; using Newtonsoft.Json; using SiteCore; using SiteCore.nuonuo; using SiteCore.taoObj; using System; using System.Collections.Generic; using System.Data; using System.Runtime.InteropServices; using System.Text; public partial class Test : System.Web.UI.Page { static HttpHelper tb_http = new HttpHelper(); public void createExcel() { //FileStream file = new FileStream(fname, FileMode.Open, FileAccess.Read); CeErpUser entity = CeErpUser.Get(1); //XSSFWorkbook xssfworkbook = new XSSFWorkbook(); //DocumentSummaryInformation dsi = PropertySetFactory.CreateDocumentSummaryInformation(); //dsi.Company = SiteName; //xssfworkbook.DocumentSummaryInformation = dsi; //SummaryInformation si = PropertySetFactory.CreateSummaryInformation(); //si.Subject = excelName; //xssfworkbook.SummaryInformation = si; // xssfworkbook.CreateSheet("Sheet1"); } [DllImport("Iphlpapi.dll")] private static extern int SendARP(Int32 dest, Int32 host, ref Int64 mac, ref Int32 length); [DllImport("Ws2_32.dll")] private static extern Int32 inet_addr(string ip); protected void Page_Load(object sender, EventArgs e) { CeErpTradeCell trade = CeErpTradeCell.GetByCtid("3091342752291422636"); int iiii = commonHelper.autoDistributeToSupplier(trade); return; //int count = 0; //string sc ="300张"; //int needSc = commonHelper.handleProductCount(sc); //return; //HttpCookie cookie = new HttpCookie("erp_df_cookie"); //cookie.Values.Add("fileDownload", "true"); //cookie.Path = "/"; //cookie.Expires = DateTime.Now.AddDays(2); //HttpContext.Current.Response.Cookies.Add(cookie); //int billCount = (int)Math.Floor(Convert.ToDouble(650.00) / 1000.00); //if (Convert.ToDouble(1000.00) % 1000.00 > 0.000001) //{ // billCount += 1; //} //billCount = billCount + 0; //commonHelper.setDeliveryUnusualOrder(); //return; //commonHelper.setDeliveryUnusualOrder(); //commonHelper.saveErpDesignerGather(); //return; //string xx= commonHelper.changeCountFromChiness("1.3万张"); //commonHelper.saveErpDesignerGather(); //string tid = "2187050186665953601"; //CeErpTradeCell main = CeErpTradeCell.GetByCtid(tid); //int idddd = commonHelper.autoDistributeToSupplier(main); //return; ////StringBuilder sql = new StringBuilder(); ////sql.AppendFormat("select * from ce_erptradecell where datalength(othermemo)>0 and pay_time2 and seller_memo not like '%电子稿%' ;", (int)OrderState.下单完成, tids, (int)OrderState.设计完成); //sql.AppendFormat("update ce_erptradecell set FinishPlaceTime=getdate(),OrderState={0},IsReturn=0 where ctid in ({1}) and orderstate={2} and IsReturn<>2 and seller_memo like '%电子稿%' ;", (int)OrderState.已发货, tids, (int)OrderState.设计完成); //sql.AppendFormat("insert into CE_ErpTradeLog(tid,orderstate,userid,operatetime,con) select ctid,{1},{2},getdate(),'{3}' from ce_erptradecell where ctid in ({0}) ;", tids, (int)OrderState.下单完成, 0, "下载设计文件"); //CeErpTradeCell.ExecuteNonQuery(sql.ToString()); //foreach (string ctid in tArr) //{ // CeErpTradeCell entrade = CeErpTradeCell.GetByCtid(ctid); // if (entrade != null) // { // CeErpTradeCell.UpdateRelationOrder(entrade); // } //} //CeErpTradeCell entity = CeErpTradeCell.GetByCtid("1977497175893223014"); //Response.Write(entity.ctid + "
"); //string ctid = "S_S_24242342342342"; //string postFile = "(S_S_24242342342342)[C2]"; //int lastIndex = ctid.LastIndexOf("S_"); //最后一个S_的位置 //string sPre = ctid.Substring(0, lastIndex + 2); //S_S_ //string initTid = ctid.Substring(lastIndex + 2, ctid.Length - lastIndex - 2); //1962772776865084101 //string pre_ctid = MidStrEx(postFile, "[", "]"); //C1 //ctid = sPre + pre_ctid + "_" + initTid; //S_S_ + C1 + _ +1962772776865084101 //return; //string sqlstr = "select * from view_erptradecell where ptid<>'' and WaitDesignTime>'2021-07-01' and OrderState>2 and seller_nick='kevin_boz';"; //DataTable dt = DbHelper.DbConn.ExecuteDataset(sqlstr).Tables[0]; //if (dt.Rows.Count > 0) //{ // foreach (DataRow dr in dt.Rows) // { // string upd = "update ce_erptradecell set orderstate=(select top 1 orderstate from ce_erptradecell where ctid not like 'S_%' and tid='" + dr["ptid"].ToString() + "') where ctid='" + dr["tid"].ToString() + "'"; // } //} //Response.Write(HttpUtility.UrlDecode("lcf1020")); //string res = apiHelper.API_TradeFullinfoGet("","2021-06-29 00:00:00", "2021-06-29 23:00:00"); //tmcHelper.Api_Tmc_CreateNewOrder(res); //apiHelper.API_TradeMemoUpdate("1330123692176573884", "YWDP001", "PURPLE", "拿样订单测试"); //apiHelper.API_LogisticsOnlineSend("1330123692176573884", "YWDP001", "ZTO", "123123123123131"); //apiHelper.API_PrintTemplate(); //apiHelper.API_GetWaybill(); //string xxx = apiHelper.API_GetPrintPage(); //return; //cainiaoLink.TMS_WAYBILL_SUBSCRIPTION_QUERY("STO"); ////taobaoHelper.TaobaoWlbWaybillISearch(); //return; //string xxx = "{\"buyer_nick\":\"走着看看着走\",\"post_fee\":\"0.00\",\"iid\":645096826899,\"end_time\":1621470351000,\"payment\":\"100.00\",\"oid\":1808895853378936731,\"seller_nick\":\"睿恒博旗舰店\",\"type\":\"guarantee_trade\",\"tid\":1808895853378936731,\"status\":\"WAIT_SELLER_SEND_GOODS\"}"; //tmcHelper.erp_TradeBuyerPay(xxx); //CeErpTradeCell cell = new CeErpTradeCell(); //cell.ctid = "123456456456456"; //cell.tid = "123456456456456"; //cell.seller_memo = "123456456456456"; //cell.Create(); //return; //CeErpTradeCell cell = CeErpTradeCell.GetByCtid("1779238586365178663"); //int k = 1; //Response.Write("OK"); //invoicing_test(); //taobaoHelper.GetAndHandleRefunds(); //Response.Write(DateTime.Now.ToString() + "," + taobaoHelper.GetSign()); //return; //bendi_test(); //taobaoTmcTest.getInfo(); //return; //string res = taobaoHelper.LogisticsCompaniesGet();//taobaoHelper.TradeFullinfoGet(sessionkey, tid); //Console.WriteLine(res); //return; //string sessionKey = "62011121cc9403ccc4a9ZZ0aaZZ369f224369206db001f02201404768885"; //Response.Write(taobaoHelper.cainiao_test(sessionKey)); //DateTime stime = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00")); //DateTime etime = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")); //string res = taobaoHelper.RefundsReceiveGet(sessionKey, stime,etime); //Console.WriteLine(res); //Refunds_receive_get_response_Obj reObj = null; //string res = taobaoHelper.test(); //if (res == "") return; //try //{ // res = GetUTF8String(Encoding.UTF8.GetBytes(res)); // //res = res.Replace(" ", ""); // reObj = JsonConvert.DeserializeObject(res); // Response.Write(reObj); //} //catch (Exception ex) //{ //} //return; //DataTable dt = tmcTest("taobao_trade_TradeBuyerPay"); //if(dt!=null && dt.Rows.Count > 0) //{ // DataRow dr = dt.Rows[0]; // tmcHelper.erp_TradeBuyerPay(dr["con"].ToString()); //} } public static string MidStrEx(string sourse, string startstr, string endstr) { string result = string.Empty; int startindex, endindex; try { startindex = sourse.IndexOf(startstr); if (startindex == -1) return result; string tmpstr = sourse.Substring(startindex + startstr.Length); endindex = tmpstr.IndexOf(endstr); if (endindex == -1) return result; result = tmpstr.Remove(endindex); } catch (Exception ex) { Console.WriteLine("MidStrEx Err:" + ex.Message); } return result; } //public static string invoicing_test() //{ // string order = "{\"identity\":\"2329CC5F90EDAA8208F1F3C72A0CE72A713A9D425CD50CDE\",\"order\":{\"buyername\":\"浙江爱信诺\",\"taxnum\":\"124511234993295177\",\"phone\":\"0\",\"address\":\"浙江省杭州市万塘路\",\"account\":\"\",\"telephone\":\"0\",\"orderno\":\"nuonuo12345\",\"invoicedate\":\"2018-10-31 19:16:51\",\"clerk\":\"黄芝\",\"saleaccount\":\"宇宙行442612010103507108\",\"salephone\":\"0774-7893911\",\"saleaddress\":\"富川瑶族自治县新永路138号\",\"saletaxnum\":\"339901999999142\",\"kptype\":\"1\",\"message\":\"\",\"payee\":\"林莉苏\",\"checker\":\"林莉苏\",\"tsfs\":\"-1\",\"email\":\"502192347@qq.com\",\"qdbz\":\"0\",\"qdxmmc\":\"\",\"dkbz\":\"0\",\"deptid\":\"\",\"clerkid\":\"\",\"invoiceLine\":\"p\",\"cpybz\":\"\",\"detail\":[{\"goodsname\":\"苹果\",\"num\":\"1\",\"price\":\"1\",\"hsbz\":\"1\",\"taxrate\":\"0.13\",\"spec\":\"\",\"unit\":\"吨\",\"spbm\":\"10101150101\",\"zxbm\":\"\",\"fphxz\":\"0\",\"yhzcbs\":\"0\",\"zzstsgl\":\"\",\"lslbs\":\"\",\"kce\":\"\"}]}}"; // //post参数 // order = DESDZFP.Encrypt(order); // //post参数 // List postLst = new List(); // postLst.Add("order=" + order); // HttpItem item = new HttpItem() // { // URL = "http://nnfpbox.nuonuocs.cn/shop/buyer/allow/cxfKp/cxfServerKpOrderSync.action", // Method = "POST", // ContentType = "application/x-www-form-urlencoded", // Postdata = string.Join("&", postLst.ToArray()) // }; // item.PostEncoding // HttpResult hResult = tb_http.GetHtml(item); // return hResult.Html; //} public static string get_invoicing_test() { string order = "{\"identity\":\"2329CC5F90EDAA8208F1F3C72A0CE72A713A9D425CD50CDE\",\"fpqqlsh\":[\"20170104160449979446\"]}"; order = DESDZFP.Encrypt(order); //post参数 List postLst = new List(); postLst.Add("order=" + order); HttpItem item = new HttpItem() { URL = "http://nnfpbox.nuonuocs.cn/shop/buyer/allow/ecOd/queryElectricKp.action", Method = "POST", ContentType = "application/x-www-form-urlencoded", Postdata = string.Join("&", postLst.ToArray()) }; HttpResult hResult = tb_http.GetHtml(item); return hResult.Html; } private DataTable tmcTest(string topic) { string sql = string.Format("select * from S_TaoBaoTmc where topic='{0}' order by id asc",topic); DataTable dt = SqlHelper.ExecuteDataSet(sql).Tables[0]; return dt; } private DataTable tmcTestAll() { string sql = string.Format("select * from S_TaoBaoTmc"); DataTable dt = SqlHelper.ExecuteDataSet(sql).Tables[0]; return dt; } private void test() { string sessionKey = "6100309b522c174d816e5218e193dd3ac90a91c452f96bc2201404768885"; string orderId = ""; string res = taobaoHelper.TradeFullinfoGet(sessionKey, "1628803047475600773"); Console.WriteLine(res); if (res == "") return; try { res = GetUTF8String(Encoding.UTF8.GetBytes(res)); Trades_sold_get_response_Obj jobj2 = JsonConvert.DeserializeObject(res); } catch (Exception ex) { Response.Write("发生错误" + res); } } private void bendi_test() { string sessionKey = "6100309b522c174d816e5218e193dd3ac90a91c452f96bc2201404768885"; string orderId = ""; //string res = taobaoHelper.TradesSoldGet(sessionKey); string res = taobaoHelper.test(); if (res == "") return; try { //"{\"trades_sold_get_response\":{\"bbc\":\"456\"}" //Response.Write(res); //"{\"trades_sold_get_response\": {\"total_results\": 2036}}" res = GetUTF8String(Encoding.UTF8.GetBytes(res)); //JObject jobj = (JObject)JsonConvert.DeserializeObject(res);//.TrimStart('{').TrimEnd('}') Trade_fullinfo_get_response_Obj jobj2 = JsonConvert.DeserializeObject(res); //int k = 1; } catch (Exception ex) { Response.Write("发生错误" + ex.Message); } } public static string GetUTF8String(byte[] buffer) { if (buffer == null) return null; if (buffer.Length <= 3) { return Encoding.UTF8.GetString(buffer); } byte[] bomBuffer = new byte[] { 0xef, 0xbb, 0xbf }; if (buffer[0] == bomBuffer[0] && buffer[1] == bomBuffer[1] && buffer[2] == bomBuffer[2]) { return new UTF8Encoding(false).GetString(buffer, 3, buffer.Length - 3); } return Encoding.UTF8.GetString(buffer); } }