sync.shop.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. using BizCom;
  2. using SQLData;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Text;
  7. namespace SiteCore.Handler
  8. {
  9. public partial class sync
  10. {
  11. //店铺档案管理接口
  12. public void get_erp_shop()
  13. {
  14. DataStruct dStruct = GetPostStruct();
  15. List<string> lw = new List<string>();
  16. string key = GetPostString("key");
  17. if (key.Length > 0) lw.Add(string.Format("shopname like '%{0}%' or sname like '%{0}%' or leadername like '%{0}%'", key));
  18. dStruct.Order = "id desc";
  19. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  20. DataTable dt = WebCache.GetData("view_erpshop", dStruct);
  21. writeGridDataTableJson(dStruct.TotalCount, dt);
  22. }
  23. public void del_erp_shop()
  24. {
  25. if (UrlPostParmsCheck("eid"))
  26. {
  27. int eid = GetPostInt("eid");
  28. CeErpShop.Del(eid);
  29. returnSuccessMsg("删除成功");
  30. }
  31. }
  32. public void save_erp_shop()
  33. {
  34. if (UrlPostParmsCheck("shopname,user"))
  35. {
  36. int eid = GetPostInt("eid");
  37. CeErpShop entity = null;
  38. if (eid > 0) entity = CeErpShop.Get(eid);
  39. else entity = new CeErpShop();
  40. entity.UserID = GetPostInt("user");
  41. entity.ComName = GetPostString("ComName");
  42. entity.AppSecret = GetPostString("AppSecret");
  43. entity.ShopName = GetPostString("ShopName");
  44. entity.design_app_id = GetPostString("design_app_id");
  45. entity.design_secret = GetPostString("design_secret");
  46. entity.SName = GetPostString("SName");
  47. entity.ShopType = GetPostString("ShopType");
  48. entity.State = GetPostInt("State");
  49. entity.orderAudit = GetPostInt("orderAudit") == 0 ? false : true;
  50. entity.AddTime = DateTime.Now;
  51. entity.Summary = GetPostString("con");
  52. if (eid > 0) entity.Update();
  53. else entity.Create();
  54. returnSuccessMsg("保存成功!");
  55. }
  56. }
  57. public void tmc_erp_shop()
  58. {
  59. string sql = "select * from ce_erpshop where appsecret<>'' and taobao_user_nick<>'' and isTmc=0";
  60. DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
  61. foreach (DataRow dr in dt.Rows)
  62. {
  63. taobaoHelper.openTmc(dr["AppSecret"].ToString(), dr["taobao_user_nick"].ToString());
  64. }
  65. returnSuccessMsg("同步授权操作完成");
  66. }
  67. //供应商档案管理接口---------------------------------------------
  68. public void get_erp_supplier()
  69. {
  70. DataStruct dStruct = GetPostStruct();
  71. List<string> lw = new List<string>();
  72. string type = GetPostString("type");
  73. if (type.Length > 0) lw.Add(" SType='" + type + "'");
  74. string key = GetPostString("key");
  75. if (key.Length > 0) lw.Add(string.Format("ComName like '%{0}%' or Leader like '%{0}%'", key));
  76. dStruct.Order = "BSort asc";
  77. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  78. DataTable dt = WebCache.GetData("ce_erpsupplier", dStruct);
  79. writeGridDataTableJson(dStruct.TotalCount, dt);
  80. }
  81. public void del_erp_supplier()
  82. {
  83. if (UrlPostParmsCheck("eid"))
  84. {
  85. int eid = GetPostInt("eid");
  86. CeErpSupplier.Del(eid);
  87. LogHelper.addSupplierLog(CurrentUser.UserID, CurrentUser.UserName, "删除", "");
  88. returnSuccessMsg("删除成功");
  89. }
  90. }
  91. public void save_erp_supplier()
  92. {
  93. if (UrlPostParmsCheck("comname"))
  94. {
  95. int eid = GetPostInt("eid");
  96. CeErpSupplier entity = null;
  97. string oldCon = "";
  98. string newCon = "";
  99. if (eid > 0)
  100. {
  101. entity = CeErpSupplier.Get(eid);
  102. oldCon = entity.ComName + "," + entity.Leader + "," + entity.Summary + "," + entity.SType + "," + entity.Address + "," + entity.Phone;
  103. }
  104. else
  105. {
  106. entity = new CeErpSupplier();
  107. }
  108. entity.ComName = GetPostString("ComName");
  109. entity.Leader = GetPostString("Leader");
  110. entity.Summary = GetPostString("Summary");
  111. entity.SType = GetPostString("SType");
  112. entity.Address = GetPostString("Address");
  113. entity.XianhuoMemo = GetPostString("XianhuoMemo");
  114. entity.Phone = GetPostString("Phone");
  115. entity.BSort = GetPostInt("BSort");
  116. newCon = entity.ComName + "," + entity.Leader + "," + entity.Summary + "," + entity.SType + "," + entity.Address + "," + entity.Phone;
  117. if (eid > 0) entity.Update();
  118. else entity.Create();
  119. LogHelper.addSupplierLog(CurrentUser.UserID, CurrentUser.UserName, oldCon, newCon);
  120. returnSuccessMsg("保存成功!");
  121. }
  122. }
  123. public void upd_supplier_isaftersale()
  124. {
  125. string ison = GetString("ison");
  126. string sid = GetString("sid");
  127. if (sid.Length > 0)
  128. {
  129. int eSid = Convert.ToInt32(sid);
  130. string sql = "";
  131. sql = "update CE_ErpSupplier set IsAfterSale=" + ison + " where id=" + eSid;
  132. DbHelper.DbConn.ExecuteNonQuery(sql.ToString());
  133. returnSuccessMsg("修改成功!");
  134. return;
  135. }
  136. returnErrorMsg("找不到供应商");
  137. }
  138. public void upd_supplier_close()
  139. {
  140. string ison = GetString("isclose");
  141. string sid = GetString("sid");
  142. if (sid.Length > 0)
  143. {
  144. int eSid = Convert.ToInt32(sid);
  145. string sql = "";
  146. sql = "update CE_ErpSupplier set IsClose=" + ison + " where id=" + eSid;
  147. DbHelper.DbConn.ExecuteNonQuery(sql.ToString());
  148. returnSuccessMsg("修改成功!");
  149. return;
  150. }
  151. returnErrorMsg("找不到供应商");
  152. }
  153. //档案-设计产品 管理接口---------------------------------------------
  154. public void get_erp_product()
  155. {
  156. DataStruct dStruct = GetPostStruct();
  157. List<string> lw = new List<string>();
  158. string key = GetPostString("key");
  159. if (key.Length > 0) lw.Add(string.Format("PType like '%{0}%' or PMaterial like '%{0}%'", key));
  160. dStruct.Order = "id asc";
  161. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  162. DataTable dt = WebCache.GetData("ce_erpproduct", dStruct);
  163. writeGridDataTableJson(dStruct.TotalCount, dt);
  164. }
  165. public void del_erp_product()
  166. {
  167. if (UrlPostParmsCheck("eid"))
  168. {
  169. int eid = GetPostInt("eid");
  170. CeErpProduct.Del(eid);
  171. returnSuccessMsg("删除成功");
  172. }
  173. }
  174. public void save_erp_product()
  175. {
  176. if (UrlPostParmsCheck("PType"))
  177. {
  178. int eid = GetPostInt("eid");
  179. CeErpProduct entity = null;
  180. if (eid > 0) entity = CeErpProduct.Get(eid);
  181. else entity = new CeErpProduct();
  182. entity.PType = GetPostString("PType");
  183. entity.PName = GetPostString("PName");
  184. entity.PNum = GetPostString("PNum");
  185. entity.PMaterial = GetPostString("PMaterial");
  186. entity.PCraft = GetPostString("PCraft");
  187. entity.UpdateTime = DateTime.Now;
  188. entity.UpdateUserName = CurrentUser.UserName;
  189. if (eid > 0) entity.Update();
  190. else
  191. {
  192. entity.CreateTime = entity.UpdateTime;
  193. entity.CreateUserName = entity.UpdateUserName;
  194. entity.Create();
  195. }
  196. returnSuccessMsg("保存成功!");
  197. }
  198. }
  199. public void save_product_form_data()
  200. {
  201. if (UrlPostParmsCheck("eid"))
  202. {
  203. int eid = GetPostInt("eid");
  204. string json = GetPostString("json");
  205. CeErpProduct entity = CeErpProduct.Get(eid);
  206. if (entity != null)
  207. {
  208. entity.FormJson = json;
  209. entity.Update();
  210. }
  211. returnSuccessMsg("保存成功!");
  212. }
  213. }
  214. public void upd_erp_productdistribute()
  215. {
  216. if (UrlPostParmsCheck("eid"))
  217. {
  218. int eid = GetPostInt("eid");
  219. CeErpProduct ent = CeErpProduct.Get(eid);
  220. if (ent != null)
  221. {
  222. if (ent.IsAutoDistribute == 0)
  223. {
  224. ent.IsAutoDistribute = 1;
  225. }
  226. else
  227. {
  228. ent.IsAutoDistribute = 0;
  229. }
  230. ent.Update();
  231. returnSuccessMsg("修改成功");
  232. return;
  233. }
  234. returnErrorMsg("找不到记录");
  235. }
  236. }
  237. public void upd_erp_productwriteprice()
  238. {
  239. if (UrlPostParmsCheck("eid"))
  240. {
  241. int eid = GetPostInt("eid");
  242. CeErpProduct ent = CeErpProduct.Get(eid);
  243. if (ent != null)
  244. {
  245. if (ent.IsNeedDesignPrice == 0)
  246. {
  247. ent.IsNeedDesignPrice = 1;
  248. }
  249. else
  250. {
  251. ent.IsNeedDesignPrice = 0;
  252. }
  253. ent.Update();
  254. returnSuccessMsg("修改成功");
  255. return;
  256. }
  257. returnErrorMsg("找不到记录");
  258. }
  259. }
  260. public void upd_erp_product_selectalldesigner()
  261. {
  262. if (UrlPostParmsCheck("eid"))
  263. {
  264. int eid = GetPostInt("eid");
  265. CeErpProduct ent = CeErpProduct.Get(eid);
  266. if (ent != null)
  267. {
  268. if (ent.IsAutoDistribute == 0)
  269. {
  270. ent.IsAutoDistribute = 1;
  271. StringBuilder sql = new StringBuilder();
  272. sql.AppendFormat("update view_ErpUser set pemDesign=pemDesign+'{0}' where PostCode='Designer' and isOpen=1 and CHARINDEX(','+'{0}'+',',','+pemDesign+',')<=0", ent.ID);
  273. DbHelper.DbConn.ExecuteNonQuery(sql.ToString());
  274. }
  275. else
  276. {
  277. ent.IsAutoDistribute = 0;
  278. StringBuilder sql = new StringBuilder();
  279. sql.AppendFormat("select * from view_ErpUser where isOpen=1 and PostCode='Designer' and CHARINDEX(','+'{0}'+',',','+pemDesign+',')>0", ent.ID);
  280. DataTable dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
  281. foreach (DataRow dr in dt.Rows)
  282. {
  283. CeErpUser user = CeErpUser.Get(dr["ID"]);
  284. if (user != null)
  285. {
  286. string newDes = "";
  287. string pemDesign = user.pemDesign;
  288. string[] desList = pemDesign.Split(',');
  289. for (int i = 0; i < desList.Length; i++)
  290. {
  291. if (Convert.ToInt32(desList[i]) != ent.ID)
  292. {
  293. newDes += desList[i];
  294. newDes += ",";
  295. }
  296. }
  297. newDes = newDes.Substring(0, newDes.Length - 1);
  298. user.pemDesign = newDes;
  299. user.Update();
  300. }
  301. }
  302. }
  303. ent.Update();
  304. returnSuccessMsg("修改成功");
  305. return;
  306. }
  307. returnErrorMsg("找不到记录");
  308. }
  309. }
  310. //档案-产品工时 管理接口---------------------------------------------
  311. public void get_erp_producthour()
  312. {
  313. DataStruct dStruct = GetPostStruct();
  314. List<string> lw = new List<string>();
  315. string key = GetPostString("key");
  316. if (key.Length > 0) lw.Add(string.Format("PType like '%{0}%' or ProductID like '%{0}%'", key));
  317. dStruct.Order = "kfTime asc";
  318. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  319. DataTable dt = WebCache.GetData("view_erpproducthour", dStruct);
  320. writeGridDataTableJson(dStruct.TotalCount, dt);
  321. }
  322. public void del_erp_producthour()
  323. {
  324. if (UrlPostParmsCheck("eid"))
  325. {
  326. int eid = GetPostInt("eid");
  327. CeErpProductHour.Del(eid);
  328. returnSuccessMsg("删除成功");
  329. }
  330. }
  331. public void save_erp_producthour()
  332. {
  333. if (UrlPostParmsCheck("PType"))
  334. {
  335. int eid = GetPostInt("eid");
  336. CeErpProductHour entity = null;
  337. if (eid > 0) entity = CeErpProductHour.Get(eid);
  338. else entity = new CeErpProductHour();
  339. entity.ProductID = GetPostInt("PType");
  340. entity.Material = GetPostString("Material");
  341. entity.Craft = GetPostString("Craft");
  342. //entity.kfTime = GetPostInt("kfTime");
  343. //entity.dsjTime = GetPostInt("dsjTime");
  344. //entity.sjzTime = GetPostInt("sjzTime");
  345. //entity.xdTime = GetPostInt("xdTime");
  346. entity.fhTime = GetPostInt("fhTime");
  347. if (eid > 0) entity.Update();
  348. else entity.Create();
  349. returnSuccessMsg("保存成功!");
  350. }
  351. }
  352. public void upd_erp_pdhour_sort()
  353. {
  354. if (UrlPostParmsCheck("eid"))
  355. {
  356. int eid = GetPostInt("eid");
  357. CeErpProductHour entity = null;
  358. if (eid > 0) entity = CeErpProductHour.Get(eid);
  359. if (entity != null)
  360. {
  361. entity.kfTime = GetPostInt("sortnum");
  362. entity.Update();
  363. returnSuccessMsg("设置成功");
  364. return;
  365. }
  366. returnErrorMsg("未找到相关数据");
  367. }
  368. }
  369. //档案-供应商产品 管理接口---------------------------------------------
  370. public void get_erp_supplierproduct()
  371. {
  372. DataStruct dStruct = GetPostStruct();
  373. List<string> lw = new List<string>();
  374. string key = GetPostString("key");
  375. if (key.Length > 0) lw.Add(string.Format("ProductName like '%{0}%' or SupplierName like '%{0}%' or ProductCrafts like '%{0}%'", key));
  376. dStruct.Order = "id asc";
  377. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  378. dStruct.Order = "SupplierID asc,Bsort asc";
  379. DataTable dt = WebCache.GetData("view_erpsupplierproduct", dStruct);
  380. writeGridDataTableJson(dStruct.TotalCount, dt);
  381. }
  382. public void del_erp_supplierproduct()
  383. {
  384. if (UrlPostParmsCheck("eid"))
  385. {
  386. int eid = GetPostInt("eid");
  387. CeErpSupplierProduct.Del(eid);
  388. returnSuccessMsg("删除成功");
  389. }
  390. }
  391. public void save_erp_supplierproduct()
  392. {
  393. if (UrlPostParmsCheck("SupplierName"))
  394. {
  395. int eid = GetPostInt("eid");
  396. CeErpSupplierProduct entity = null;
  397. string oldCon = "";
  398. string newCon = "";
  399. if (eid > 0)
  400. {
  401. entity = CeErpSupplierProduct.Get(eid);
  402. }
  403. else
  404. {
  405. entity = new CeErpSupplierProduct();
  406. }
  407. entity.ProductIds = GetPostString("ProductValue");
  408. entity.ProductText = GetPostString("ProductText");
  409. entity.SupplierID = GetPostInt("SupplierName");
  410. entity.ProductCrafts = GetPostString("ProductCrafts");
  411. entity.Crafts = GetPostString("Crafts");
  412. entity.MinNum = GetPostInt("MinNum");
  413. entity.MaxNum = GetPostInt("MaxNum");
  414. entity.SizeL = GetPostInt("SizeL");
  415. entity.SizeW = GetPostInt("SizeW");
  416. entity.Area = GetPostString("Area");
  417. if (eid > 0) entity.Update();
  418. else entity.Create();
  419. //LogHelper.addSupplierLog(CurrentUser.UserID, CurrentUser.UserName, oldCon, newCon);
  420. returnSuccessMsg("保存成功!");
  421. }
  422. }
  423. //档案-开票公司信息---------------------------------------------
  424. public void get_erp_invoicinglist()
  425. {
  426. DataStruct dStruct = GetPostStruct();
  427. List<string> lw = new List<string>();
  428. string key = GetPostString("key");
  429. if (key.Length > 0) lw.Add(string.Format("ComName like '%{0}%' or tax like '%{0}%'", key));
  430. dStruct.Order = "id desc";
  431. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  432. DataTable dt = WebCache.GetData("ce_erpinvoicinginfo", dStruct);
  433. writeGridDataTableJson(dStruct.TotalCount, dt);
  434. }
  435. public void del_erp_invoicing()
  436. {
  437. if (UrlPostParmsCheck("eid"))
  438. {
  439. int eid = GetPostInt("eid");
  440. CeErpInvoicingInfo.Del(eid);
  441. returnSuccessMsg("删除成功");
  442. }
  443. }
  444. public void save_erp_invoicinginfo()
  445. {
  446. if (UrlPostParmsCheck("ComName,tax"))
  447. {
  448. int eid = GetPostInt("eid");
  449. CeErpInvoicingInfo entity = null;
  450. if (eid > 0) entity = CeErpInvoicingInfo.Get(eid);
  451. else entity = new CeErpInvoicingInfo();
  452. entity.ComName = GetPostString("ComName");
  453. entity.CName = GetPostString("CName");
  454. entity.Tax = GetPostString("Tax");
  455. entity.taxrate = GetPostString("taxrate");
  456. entity.Address = GetPostString("Address");
  457. entity.Phone = GetPostString("Phone");
  458. entity.Bank = GetPostString("Bank");
  459. entity.BankAcc = GetPostString("BankAcc");
  460. entity.BillKey = GetPostString("BillKey");
  461. entity.legal = GetPostString("legal");
  462. entity.LimitPrice = Convert.ToDouble(GetPostString("LimitPrice"));
  463. if (eid > 0) entity.Update();
  464. else entity.Create();
  465. returnSuccessMsg("保存成功!");
  466. }
  467. }
  468. //获取买家客户信息
  469. public void get_erp_customerinfo()
  470. {
  471. DataStruct dStruct = GetPostStruct();
  472. List<string> lw = new List<string>();
  473. string key = GetPostString("key");
  474. if (key.Length > 0) lw.Add(string.Format("buyer_nick like '%{0}%' or phone like '%{0}%'", key));
  475. dStruct.Order = "id desc";
  476. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  477. DataTable dt = WebCache.GetData("CE_ErpCustomer", dStruct);
  478. writeGridDataTableJson(dStruct.TotalCount, dt);
  479. }
  480. //行业
  481. public void get_erp_professionlist()
  482. {
  483. DataStruct dStruct = GetPostStruct();
  484. List<string> lw = new List<string>();
  485. string key = GetPostString("key");
  486. if (key.Length > 0) lw.Add(string.Format("Name like '%{0}%'", key));
  487. dStruct.Order = "id desc";
  488. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  489. DataTable dt = WebCache.GetData("CE_ErpProfession", dStruct);
  490. con.Response.Write(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
  491. }
  492. public void save_erp_profession()
  493. {
  494. if (UrlPostParmsCheck("profession"))
  495. {
  496. int eid = GetPostInt("eid");
  497. CeErpProfession entity = null;
  498. if (eid > 0) entity = CeErpProfession.Get(eid);
  499. else entity = new CeErpProfession();
  500. entity.Name = GetPostString("profession");
  501. string pid = GetPostString("pid");
  502. if (pid.Length > 0)
  503. {
  504. entity.PID = Convert.ToInt32(pid);
  505. }
  506. else
  507. {
  508. entity.PID = -1;
  509. }
  510. if (eid > 0) entity.Update();
  511. else
  512. {
  513. entity.AddTime = DateTime.Now;
  514. entity.Create();
  515. }
  516. returnSuccessMsg("保存成功!");
  517. }
  518. }
  519. public void del_erp_profession()
  520. {
  521. if (UrlPostParmsCheck("eid"))
  522. {
  523. int eid = GetPostInt("eid");
  524. CeErpProfession.Del(eid);
  525. returnSuccessMsg("删除成功");
  526. }
  527. }
  528. //设计费列表
  529. public void get_erp_prdouctPrice()
  530. {
  531. DataStruct dStruct = GetPostStruct();
  532. List<string> lw = new List<string>();
  533. string key = GetPostString("key");
  534. if (key.Length > 0) lw.Add(string.Format("pType like '%{0}%' or tax like '%{0}%'", key));
  535. dStruct.Order = "pType desc";
  536. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  537. DataTable dt = WebCache.GetData("CE_ErpProductPrice", dStruct);
  538. writeGridDataTableJson(dStruct.TotalCount, dt);
  539. }
  540. public void save_erp_productPrice()
  541. {
  542. if (UrlPostParmsCheck("PType"))
  543. {
  544. int eid = GetPostInt("eid");
  545. int pid = GetPostInt("pType");
  546. CeErpProductPrice entity = null;
  547. if (eid > 0) entity = CeErpProductPrice.Get(eid);
  548. else entity = new CeErpProductPrice();
  549. CeErpProduct entitys = CeErpProduct.Get(pid);
  550. entity.pClass = GetPostInt("pClass");
  551. //entity.pClassText = ProductCategory.getText(entity.pClass);
  552. entity.pType = entitys.ID;
  553. entity.pTypeText = entitys.PType;
  554. entity.ws = GetPostDouble("ws");
  555. entity.pMaterial = GetPostString("pMaterial");
  556. entity.modifyPrice = GetPostDouble("modifyPrice");
  557. entity.designPrice = GetPostDouble("designPrice");
  558. if (eid > 0) entity.Update();
  559. else entity.Create();
  560. returnSuccessMsg("保存成功!");
  561. }
  562. }
  563. public void del_erp_productPrice()
  564. {
  565. if (UrlPostParmsCheck("eid"))
  566. {
  567. int eid = GetPostInt("eid");
  568. CeErpProductPrice.Del(eid);
  569. returnSuccessMsg("删除成功");
  570. }
  571. }
  572. //快递管理
  573. public void get_erp_maillist()
  574. {
  575. DataStruct dStruct = GetPostStruct();
  576. List<string> lw = new List<string>();
  577. string key = GetPostString("key");
  578. if (key.Length > 0) lw.Add(string.Format("Name like '%{0}%'", key));
  579. dStruct.Order = "id desc";
  580. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  581. DataTable dt = WebCache.GetData("CE_ErpMailInfo", dStruct);
  582. con.Response.Write(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
  583. }
  584. public void save_erp_mailinfo()
  585. {
  586. if (UrlPostParmsCheck("name"))
  587. {
  588. int eid = GetPostInt("eid");
  589. CeErpMailInfo entity = null;
  590. if (eid > 0) entity = CeErpMailInfo.Get(eid);
  591. else entity = new CeErpMailInfo();
  592. entity.name = GetPostString("name");
  593. entity.code = GetPostString("code");
  594. entity.cpCode = GetPostString("cpcode");
  595. if (eid > 0) entity.Update();
  596. else
  597. {
  598. entity.addTime = DateTime.Now;
  599. entity.Create();
  600. }
  601. returnSuccessMsg("保存成功!");
  602. }
  603. }
  604. public void del_erp_mailinfo()
  605. {
  606. if (UrlPostParmsCheck("eid"))
  607. {
  608. int eid = GetPostInt("eid");
  609. CeErpMailInfo.Del(eid);
  610. returnSuccessMsg("删除成功");
  611. }
  612. }
  613. public void upd_mail_auth()
  614. {
  615. int aid = GetPostInt("aid");
  616. int tag = GetPostInt("tag");
  617. CeErpMailInfo entity = null;
  618. if (aid > 0) entity = CeErpMailInfo.Get(aid);
  619. if (entity != null)
  620. {
  621. entity.isAuth = tag;
  622. entity.Update();
  623. returnSuccessMsg("修改成功");
  624. return;
  625. }
  626. returnErrorMsg("没有找到数据");
  627. }
  628. }
  629. }