| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- 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_time<CONVERT(datetime,'2021-09-27 09:30:00')");
- ////DataTable dt = CeErpUser.ExecuteDataset(sql.ToString()).Tables[0];
- ////foreach(DataRow dr in dt.Rows)
- ////{
- //// CeErpTrade father = CeErpTrade.Get(dr["tid"].ToString());
- //// if (father!=null)
- //// {
- //// tmcHelper.createCellOrder(father, father.tid, father.seller_memo, father.buyer_nick, true);
- //// }
- ////}
- //return;
- //string sc = "1000张";
- //string needSc = System.Text.RegularExpressions.Regex.Replace(sc, @"[^0-9]+", "");
- //return;
- //string pData_str = apiHelper.API_GetPrintData_SF("SF1331407611984");
- //return;
- //string msg = "{\"content\":{\"buyerMemo\":\"\",\"createTime\":1652169317000,\"discountFee\":5.0,\"finishTime\":1653240783000,\"flag\":\"NONE\",\"lines\":[{\"num\":4,\"outerId\":\"\",\"picUrl\":\"https://img.alicdn.com/bao/uploaded/i2/784102056/O1CN015JMFcy1R3gz00jqy1_!!784102056.jpg\",\"price\":30.0,\"refOlId\":\"2623127259034339132\",\"refSkuId\":\"4438824914900\",\"refSpuId\":\"556635919506\",\"refundStatus\":\"NO_REFUND\",\"sellPrice\":28.75,\"singleFee\":28.75,\"standards\":\"定制专拍\",\"status\":\"COMPLETE\",\"title\":\"花店标签定做商标印logo外卖不干胶奶茶二维码蛋糕烘焙贴纸定制作\",\"totalFee\":115.0,\"totalPrice\":120.0,\"totalSellPrice\":115.0}],\"modifyTime\":1653240796000,\"openBuyerNick\":\"张娇娇202659\",\"openSellerNick\":\"kevin_boz\",\"orderTime\":1652169285000,\"payTime\":1652169314000,\"payment\":115.0,\"posCode\":\"yujia\",\"postFee\":0.0,\"receivedPayment\":115.0,\"receiverCity\":\"南通市\",\"receiverCountry\":\"中国\",\"receiverDistrict\":\"如东县\",\"receiverId\":\"a5b2392a6dafabb757bf2ba58464e064\",\"receiverState\":\"江苏省\",\"receiverTown\":\"长沙镇\",\"refOid\":\"2623127259034339132\",\"refType\":\"TMALL\",\"refundStatus\":\"NO_REFUND\",\"sellerMemo\":\"85x54mm-2000张-卡片-300克铜板纸-卡片双面印刷覆哑膜-大佐\",\"serviceFee\":0.0,\"shippingTime\":1652376771000,\"status\":\"COMPLETE\",\"totalFee\":115.0,\"totalPrice\":120.0,\"totalSellPrice\":115.0}}";
- //tmcHelper.Api_TmcTradeMsg(msg);
- //return;
- ////CeErpTradeCell entity = null;
- ////entity = CeErpTradeCell.GetByCtid_M("2038003957105948755");
- ////string en = entity.seller_memo;
- //return;
- //CeErpTradeCell.UpdateRelationOrder("123");
- //CeErpTradeCell enti = CeErpTradeCell.GetByCtid("2091930303202747015");
- //commonHelper.autoDistributeToSupplier(enti);
- //return;
- //CeErpShop nShop = CeErpShop.GetShopIdByName("琳19890725");
- //int shopId = 0;
- //if (nShop != null)
- //{
- // shopId = nShop.ID;
- //}
- //createExcel();
- //return;
- //StringBuilder sql = new StringBuilder();
- //sql.AppendFormat("select * from ce_erpuser");
- //DataTable dt = CeErpUser.ExecuteDataset(sql.ToString()).Tables[0];
- //Response.Write(dt.Rows.Count);
- //SqlParameter[] sqlParameter ={
- // new SqlParameter("@mainctids", SqlDbType.VarChar,100),
- // new SqlParameter("@res", SqlDbType.VarChar, 4000)
- // };
- //sqlParameter[0].Value = "1782296064444052131,1781979878135270634"; //1781979878135270634
- //sqlParameter[1].Direction = ParameterDirection.Output;
- //DbHelper.DbConn.ExecuteNonQuery(CommandType.StoredProcedure, "sp_set_download", sqlParameter);
- //string xxx = "1963426392010756507";
- //string[] tArr = xxx.Split(',');
- //string tids ="'"+ xxx+"'";
- //StringBuilder sql = new StringBuilder();
- //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 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 + "<br>");
- //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<Refunds_receive_get_response_Obj>(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<string> postLst = new List<string>();
- // 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<string> postLst = new List<string>();
- 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<Trades_sold_get_response_Obj>(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<Trade_fullinfo_get_response_Obj>(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);
- }
- }
|