sync.shop.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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. entity.uuid = entity.PType;
  190. if (eid > 0) entity.Update();
  191. else
  192. {
  193. CeErpProduct old = CeErpProduct.GetByName(entity.PType);
  194. if (old != null)
  195. {
  196. returnErrorMsg("已存在产品");
  197. return;
  198. }
  199. entity.CreateTime = entity.UpdateTime;
  200. entity.CreateUserName = entity.UpdateUserName;
  201. entity.Create();
  202. }
  203. returnSuccessMsg("保存成功!");
  204. }
  205. }
  206. public void save_product_form_data()
  207. {
  208. if (UrlPostParmsCheck("eid"))
  209. {
  210. int eid = GetPostInt("eid");
  211. string json = GetPostString("json");
  212. CeErpProduct entity = CeErpProduct.Get(eid);
  213. if (entity != null)
  214. {
  215. entity.FormJson = json;
  216. entity.Update();
  217. }
  218. returnSuccessMsg("保存成功!");
  219. }
  220. }
  221. public void upd_erp_productdistribute()
  222. {
  223. if (UrlPostParmsCheck("eid"))
  224. {
  225. int eid = GetPostInt("eid");
  226. CeErpProduct ent = CeErpProduct.Get(eid);
  227. if (ent != null)
  228. {
  229. if (ent.IsAutoDistribute == 0)
  230. {
  231. ent.IsAutoDistribute = 1;
  232. }
  233. else
  234. {
  235. ent.IsAutoDistribute = 0;
  236. }
  237. ent.Update();
  238. returnSuccessMsg("修改成功");
  239. return;
  240. }
  241. returnErrorMsg("找不到记录");
  242. }
  243. }
  244. public void upd_erp_productwriteprice()
  245. {
  246. if (UrlPostParmsCheck("eid"))
  247. {
  248. int eid = GetPostInt("eid");
  249. CeErpProduct ent = CeErpProduct.Get(eid);
  250. if (ent != null)
  251. {
  252. if (ent.IsNeedDesignPrice == 0)
  253. {
  254. ent.IsNeedDesignPrice = 1;
  255. }
  256. else
  257. {
  258. ent.IsNeedDesignPrice = 0;
  259. }
  260. ent.Update();
  261. returnSuccessMsg("修改成功");
  262. return;
  263. }
  264. returnErrorMsg("找不到记录");
  265. }
  266. }
  267. public void upd_erp_product_selectalldesigner()
  268. {
  269. if (UrlPostParmsCheck("eid"))
  270. {
  271. int eid = GetPostInt("eid");
  272. CeErpProduct ent = CeErpProduct.Get(eid);
  273. if (ent != null)
  274. {
  275. if (ent.IsAutoDistribute == 0)
  276. {
  277. ent.IsAutoDistribute = 1;
  278. StringBuilder sql = new StringBuilder();
  279. sql.AppendFormat("update view_ErpUser set pemDesign=pemDesign+'{0}' where PostCode='Designer' and isOpen=1 and CHARINDEX(','+'{0}'+',',','+pemDesign+',')<=0", ent.ID);
  280. DbHelper.DbConn.ExecuteNonQuery(sql.ToString());
  281. }
  282. else
  283. {
  284. ent.IsAutoDistribute = 0;
  285. StringBuilder sql = new StringBuilder();
  286. sql.AppendFormat("select * from view_ErpUser where isOpen=1 and PostCode='Designer' and CHARINDEX(','+'{0}'+',',','+pemDesign+',')>0", ent.ID);
  287. DataTable dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
  288. foreach (DataRow dr in dt.Rows)
  289. {
  290. CeErpUser user = CeErpUser.Get(dr["ID"]);
  291. if (user != null)
  292. {
  293. string newDes = "";
  294. string pemDesign = user.pemDesign;
  295. string[] desList = pemDesign.Split(',');
  296. for (int i = 0; i < desList.Length; i++)
  297. {
  298. if (Convert.ToInt32(desList[i]) != ent.ID)
  299. {
  300. newDes += desList[i];
  301. newDes += ",";
  302. }
  303. }
  304. newDes = newDes.Substring(0, newDes.Length - 1);
  305. user.pemDesign = newDes;
  306. user.Update();
  307. }
  308. }
  309. }
  310. ent.Update();
  311. returnSuccessMsg("修改成功");
  312. return;
  313. }
  314. returnErrorMsg("找不到记录");
  315. }
  316. }
  317. //档案-产品工时 管理接口---------------------------------------------
  318. public void get_erp_producthour()
  319. {
  320. DataStruct dStruct = GetPostStruct();
  321. List<string> lw = new List<string>();
  322. string key = GetPostString("key");
  323. if (key.Length > 0) lw.Add(string.Format("PType like '%{0}%' or ProductID like '%{0}%'", key));
  324. dStruct.Order = "kfTime asc";
  325. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  326. DataTable dt = WebCache.GetData("view_erpproducthour", dStruct);
  327. writeGridDataTableJson(dStruct.TotalCount, dt);
  328. }
  329. public void del_erp_producthour()
  330. {
  331. if (UrlPostParmsCheck("eid"))
  332. {
  333. int eid = GetPostInt("eid");
  334. CeErpProductHour.Del(eid);
  335. returnSuccessMsg("删除成功");
  336. }
  337. }
  338. public void save_erp_producthour()
  339. {
  340. if (UrlPostParmsCheck("PType"))
  341. {
  342. int eid = GetPostInt("eid");
  343. CeErpProductHour entity = null;
  344. if (eid > 0) entity = CeErpProductHour.Get(eid);
  345. else entity = new CeErpProductHour();
  346. entity.ProductID = GetPostInt("PType");
  347. entity.Material = GetPostString("Material");
  348. entity.Craft = GetPostString("Craft");
  349. //entity.kfTime = GetPostInt("kfTime");
  350. //entity.dsjTime = GetPostInt("dsjTime");
  351. //entity.sjzTime = GetPostInt("sjzTime");
  352. //entity.xdTime = GetPostInt("xdTime");
  353. entity.fhTime = GetPostInt("fhTime");
  354. if (eid > 0) entity.Update();
  355. else entity.Create();
  356. returnSuccessMsg("保存成功!");
  357. }
  358. }
  359. public void upd_erp_pdhour_sort()
  360. {
  361. if (UrlPostParmsCheck("eid"))
  362. {
  363. int eid = GetPostInt("eid");
  364. CeErpProductHour entity = null;
  365. if (eid > 0) entity = CeErpProductHour.Get(eid);
  366. if (entity != null)
  367. {
  368. entity.kfTime = GetPostInt("sortnum");
  369. entity.Update();
  370. returnSuccessMsg("设置成功");
  371. return;
  372. }
  373. returnErrorMsg("未找到相关数据");
  374. }
  375. }
  376. //档案-供应商产品 管理接口---------------------------------------------
  377. public void get_erp_supplierproduct()
  378. {
  379. DataStruct dStruct = GetPostStruct();
  380. List<string> lw = new List<string>();
  381. string key = GetPostString("key");
  382. if (key.Length > 0) lw.Add(string.Format("ProductName like '%{0}%' or SupplierName like '%{0}%' or ProductCrafts like '%{0}%'", key));
  383. dStruct.Order = "id asc";
  384. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  385. dStruct.Order = "SupplierID asc,Bsort asc";
  386. DataTable dt = WebCache.GetData("view_erpsupplierproduct", dStruct);
  387. writeGridDataTableJson(dStruct.TotalCount, dt);
  388. }
  389. public void del_erp_supplierproduct()
  390. {
  391. if (UrlPostParmsCheck("eid"))
  392. {
  393. int eid = GetPostInt("eid");
  394. CeErpSupplierProduct.Del(eid);
  395. returnSuccessMsg("删除成功");
  396. }
  397. }
  398. public void save_erp_supplierproduct()
  399. {
  400. if (UrlPostParmsCheck("SupplierName"))
  401. {
  402. int eid = GetPostInt("eid");
  403. CeErpSupplierProduct entity = null;
  404. string oldCon = "";
  405. string newCon = "";
  406. if (eid > 0)
  407. {
  408. entity = CeErpSupplierProduct.Get(eid);
  409. }
  410. else
  411. {
  412. entity = new CeErpSupplierProduct();
  413. }
  414. entity.ProductIds = GetPostString("ProductValue");
  415. entity.ProductText = GetPostString("ProductText");
  416. entity.SupplierID = GetPostInt("SupplierName");
  417. entity.ProductCrafts = GetPostString("ProductCrafts");
  418. entity.Crafts = GetPostString("Crafts");
  419. entity.MinNum = GetPostInt("MinNum");
  420. entity.MaxNum = GetPostInt("MaxNum");
  421. entity.SizeL = GetPostInt("SizeL");
  422. entity.SizeW = GetPostInt("SizeW");
  423. entity.Area = GetPostString("Area");
  424. if (eid > 0) entity.Update();
  425. else entity.Create();
  426. //LogHelper.addSupplierLog(CurrentUser.UserID, CurrentUser.UserName, oldCon, newCon);
  427. returnSuccessMsg("保存成功!");
  428. }
  429. }
  430. //档案-开票公司信息---------------------------------------------
  431. public void get_erp_invoicinglist()
  432. {
  433. DataStruct dStruct = GetPostStruct();
  434. List<string> lw = new List<string>();
  435. string key = GetPostString("key");
  436. if (key.Length > 0) lw.Add(string.Format("ComName like '%{0}%' or tax like '%{0}%'", key));
  437. dStruct.Order = "id desc";
  438. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  439. DataTable dt = WebCache.GetData("ce_erpinvoicinginfo", dStruct);
  440. writeGridDataTableJson(dStruct.TotalCount, dt);
  441. }
  442. public void del_erp_invoicing()
  443. {
  444. if (UrlPostParmsCheck("eid"))
  445. {
  446. int eid = GetPostInt("eid");
  447. CeErpInvoicingInfo.Del(eid);
  448. returnSuccessMsg("删除成功");
  449. }
  450. }
  451. public void save_erp_invoicinginfo()
  452. {
  453. if (UrlPostParmsCheck("ComName,tax"))
  454. {
  455. int eid = GetPostInt("eid");
  456. CeErpInvoicingInfo entity = null;
  457. if (eid > 0) entity = CeErpInvoicingInfo.Get(eid);
  458. else entity = new CeErpInvoicingInfo();
  459. entity.ComName = GetPostString("ComName");
  460. entity.CName = GetPostString("CName");
  461. entity.Tax = GetPostString("Tax");
  462. entity.taxrate = GetPostString("taxrate");
  463. entity.Address = GetPostString("Address");
  464. entity.Phone = GetPostString("Phone");
  465. entity.Bank = GetPostString("Bank");
  466. entity.BankAcc = GetPostString("BankAcc");
  467. entity.BillKey = GetPostString("BillKey");
  468. entity.legal = GetPostString("legal");
  469. entity.LimitPrice = Convert.ToDouble(GetPostString("LimitPrice"));
  470. if (eid > 0) entity.Update();
  471. else entity.Create();
  472. returnSuccessMsg("保存成功!");
  473. }
  474. }
  475. //获取买家客户信息
  476. public void get_erp_customerinfo()
  477. {
  478. DataStruct dStruct = GetPostStruct();
  479. List<string> lw = new List<string>();
  480. string key = GetPostString("key");
  481. if (key.Length > 0) lw.Add(string.Format("buyer_nick like '%{0}%' or phone like '%{0}%'", key));
  482. dStruct.Order = "id desc";
  483. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  484. DataTable dt = WebCache.GetData("CE_ErpCustomer", dStruct);
  485. writeGridDataTableJson(dStruct.TotalCount, dt);
  486. }
  487. //行业
  488. public void get_erp_professionlist()
  489. {
  490. DataStruct dStruct = GetPostStruct();
  491. List<string> lw = new List<string>();
  492. string key = GetPostString("key");
  493. if (key.Length > 0) lw.Add(string.Format("Name like '%{0}%'", key));
  494. dStruct.Order = "id desc";
  495. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  496. DataTable dt = WebCache.GetData("CE_ErpProfession", dStruct);
  497. con.Response.Write(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
  498. }
  499. public void save_erp_profession()
  500. {
  501. if (UrlPostParmsCheck("profession"))
  502. {
  503. int eid = GetPostInt("eid");
  504. CeErpProfession entity = null;
  505. if (eid > 0) entity = CeErpProfession.Get(eid);
  506. else entity = new CeErpProfession();
  507. entity.Name = GetPostString("profession");
  508. string pid = GetPostString("pid");
  509. if (pid.Length > 0)
  510. {
  511. entity.PID = Convert.ToInt32(pid);
  512. }
  513. else
  514. {
  515. entity.PID = -1;
  516. }
  517. if (eid > 0) entity.Update();
  518. else
  519. {
  520. entity.AddTime = DateTime.Now;
  521. entity.Create();
  522. }
  523. returnSuccessMsg("保存成功!");
  524. }
  525. }
  526. public void del_erp_profession()
  527. {
  528. if (UrlPostParmsCheck("eid"))
  529. {
  530. int eid = GetPostInt("eid");
  531. CeErpProfession.Del(eid);
  532. returnSuccessMsg("删除成功");
  533. }
  534. }
  535. //设计费列表
  536. public void get_erp_prdouctPrice()
  537. {
  538. DataStruct dStruct = GetPostStruct();
  539. List<string> lw = new List<string>();
  540. string key = GetPostString("key");
  541. if (key.Length > 0) lw.Add(string.Format("pType like '%{0}%' or tax like '%{0}%'", key));
  542. dStruct.Order = "pType desc";
  543. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  544. DataTable dt = WebCache.GetData("CE_ErpProductPrice", dStruct);
  545. writeGridDataTableJson(dStruct.TotalCount, dt);
  546. }
  547. public void save_erp_productPrice()
  548. {
  549. if (UrlPostParmsCheck("PType"))
  550. {
  551. int eid = GetPostInt("eid");
  552. int pid = GetPostInt("pType");
  553. CeErpProductPrice entity = null;
  554. if (eid > 0) entity = CeErpProductPrice.Get(eid);
  555. else entity = new CeErpProductPrice();
  556. CeErpProduct entitys = CeErpProduct.Get(pid);
  557. entity.pClass = GetPostInt("pClass");
  558. //entity.pClassText = ProductCategory.getText(entity.pClass);
  559. entity.pType = entitys.ID;
  560. entity.pTypeText = entitys.PType;
  561. entity.ws = GetPostDouble("ws");
  562. entity.pMaterial = GetPostString("pMaterial");
  563. entity.modifyPrice = GetPostDouble("modifyPrice");
  564. entity.designPrice = GetPostDouble("designPrice");
  565. if (eid > 0) entity.Update();
  566. else entity.Create();
  567. returnSuccessMsg("保存成功!");
  568. }
  569. }
  570. public void del_erp_productPrice()
  571. {
  572. if (UrlPostParmsCheck("eid"))
  573. {
  574. int eid = GetPostInt("eid");
  575. CeErpProductPrice.Del(eid);
  576. returnSuccessMsg("删除成功");
  577. }
  578. }
  579. //快递管理
  580. public void get_erp_maillist()
  581. {
  582. DataStruct dStruct = GetPostStruct();
  583. List<string> lw = new List<string>();
  584. string key = GetPostString("key");
  585. if (key.Length > 0) lw.Add(string.Format("Name like '%{0}%'", key));
  586. dStruct.Order = "id desc";
  587. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  588. DataTable dt = WebCache.GetData("CE_ErpMailInfo", dStruct);
  589. con.Response.Write(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
  590. }
  591. public void save_erp_mailinfo()
  592. {
  593. if (UrlPostParmsCheck("name"))
  594. {
  595. int eid = GetPostInt("eid");
  596. CeErpMailInfo entity = null;
  597. if (eid > 0) entity = CeErpMailInfo.Get(eid);
  598. else entity = new CeErpMailInfo();
  599. entity.name = GetPostString("name");
  600. entity.code = GetPostString("code");
  601. entity.cpCode = GetPostString("cpcode");
  602. if (eid > 0) entity.Update();
  603. else
  604. {
  605. entity.addTime = DateTime.Now;
  606. entity.Create();
  607. }
  608. returnSuccessMsg("保存成功!");
  609. }
  610. }
  611. public void del_erp_mailinfo()
  612. {
  613. if (UrlPostParmsCheck("eid"))
  614. {
  615. int eid = GetPostInt("eid");
  616. CeErpMailInfo.Del(eid);
  617. returnSuccessMsg("删除成功");
  618. }
  619. }
  620. public void upd_mail_auth()
  621. {
  622. int aid = GetPostInt("aid");
  623. int tag = GetPostInt("tag");
  624. CeErpMailInfo entity = null;
  625. if (aid > 0) entity = CeErpMailInfo.Get(aid);
  626. if (entity != null)
  627. {
  628. entity.isAuth = tag;
  629. entity.Update();
  630. returnSuccessMsg("修改成功");
  631. return;
  632. }
  633. returnErrorMsg("没有找到数据");
  634. }
  635. }
  636. }