sync.zhangdan.cs 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using BizCom;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. namespace SiteCore.Handler
  6. {
  7. public partial class sync
  8. {
  9. //账单导入接口
  10. public void get_erp_zhangdan()
  11. {
  12. DataStruct dStruct = GetPostStruct();
  13. List<string> lw = new List<string>();
  14. string tid = GetPostString("tid");
  15. if (tid.Length > 0) lw.Add(string.Format("tid like '%{0}%'", tid));
  16. string shopName = GetPostString("shopName");
  17. if (shopName.Length > 0) lw.Add(string.Format("shopName like '%{0}%'", shopName));
  18. string batchNo = GetPostString("batchNo");
  19. if (batchNo.Length > 0) lw.Add(string.Format("batchNo like '%{0}%'", batchNo));
  20. string supplierName = GetPostString("supplierName");
  21. if (supplierName.Length > 0) lw.Add(string.Format("ComName like '%{0}%'", supplierName));
  22. string logistics = GetPostString("logistics");
  23. if (logistics.Length > 0) lw.Add(string.Format("logistics like '%{0}%'", logistics));
  24. string state = GetPostString("state");
  25. if (state.Length > 0) lw.Add(string.Format("state = {0}", state));
  26. string date1 = GetPostString("date1");
  27. if (date1.Length > 0) lw.Add(string.Format("importDate >= '{0}'", date1));
  28. string date2 = GetPostString("date2");
  29. if (date2.Length > 0) lw.Add(string.Format("importDate <= '{0}'", date2));
  30. string price1 = GetPostString("price1");
  31. if (price1.Length > 0) lw.Add(string.Format("total >= {0}", price1));
  32. string price2 = GetPostString("price2");
  33. if (price2.Length > 0) lw.Add(string.Format("total <= {0}", price2));
  34. string unusual = GetPostString("unusual");
  35. if (unusual.Length > 0) lw.Add(string.Format("unusual like '%{0}%'", unusual));
  36. dStruct.Order = "tid desc";
  37. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  38. DataTable dt = WebCache.GetData("view_ZhangDan", dStruct);
  39. writeGridDataTableJson(dStruct.TotalCount, dt);
  40. }
  41. public void del_erp_zhangdan()
  42. {
  43. if (UrlPostParmsCheck("eid"))
  44. {
  45. int eid = GetPostInt("eid");
  46. CeErpShop.Del(eid);
  47. returnSuccessMsg("删除成功");
  48. }
  49. }
  50. public void save_erp_zhangdan()
  51. {
  52. if (UrlPostParmsCheck("shopname,user"))
  53. {
  54. int eid = GetPostInt("eid");
  55. CeErpShop entity = null;
  56. if (eid > 0) entity = CeErpShop.Get(eid);
  57. else entity = new CeErpShop();
  58. entity.UserID = GetPostInt("user");
  59. entity.ComName = GetPostString("ComName");
  60. entity.AppSecret = GetPostString("AppSecret");
  61. entity.ShopName = GetPostString("ShopName");
  62. entity.SName = GetPostString("SName");
  63. entity.ShopType = GetPostString("ShopType");
  64. entity.State = GetPostInt("State");
  65. entity.AddTime = DateTime.Now;
  66. entity.Summary = GetPostString("con");
  67. if (eid > 0) entity.Update();
  68. else entity.Create();
  69. returnSuccessMsg("保存成功!");
  70. }
  71. }
  72. //账单新增异常接口
  73. public void save_erp_zhangdan_unusual()
  74. {
  75. if (UrlPostParmsCheck("id"))
  76. {
  77. int id = GetPostInt("id");
  78. string unusual = GetPostString("unusual");
  79. CeErpZhangDan entity = null;
  80. entity = CeErpZhangDan.GetById(id);
  81. if (entity != null)
  82. {
  83. entity.unusual = unusual;
  84. entity.Update();
  85. returnSuccessMsg("异常说明保存成功!");
  86. return;
  87. }
  88. else
  89. returnErrorMsg("找不到记录");
  90. }
  91. }
  92. }
  93. }