sync.shop.cs 26 KB

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