PushRecordController.cs 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  1. using JCSoft.WX.Framework.Api;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Microsoft.AspNetCore.Http;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. using Common.Wechat;
  9. using Common;
  10. using System.Data;
  11. using ZcPeng.PublicLibrary;
  12. using CoreEntity.Entity;
  13. using Common.Model;
  14. using Newtonsoft.Json.Converters;
  15. using Newtonsoft.Json;
  16. using System.Data.SqlClient;
  17. using CoreEntity.TimedTask;
  18. using ZcPeng.weixin.PublicAccount;
  19. using CoreEntity.DAL;
  20. using CoreEntity.TimeJob;
  21. using PublicLibrary.Model;
  22. using Microsoft.Extensions.Caching.Memory;
  23. using PublicLibrary.Common;
  24. using CoreEntity.BAL;
  25. using SupplierWeb.Codes.mvc;
  26. using SupplierWeb.Codes.Push;
  27. using Npoi.Mapper;
  28. using System.IO;
  29. using Microsoft.AspNetCore.Hosting;
  30. using LigerRM.Common;
  31. namespace SupplierWeb.Controllers
  32. {
  33. [Route("web/push")]
  34. public class PushRecordController : BaseController
  35. {
  36. public PushRecordController(IMemoryCache cache, IApiClient client) : base(cache, client)
  37. {
  38. }
  39. //查看有缺口的药品给关注的供应商业务员推送记录
  40. [AuthPermission]
  41. [HttpPost, Route("pushrecord/{staffId}")]
  42. public ActionResult PushRecord(QueryFilter[] filters, Int32 pageIndex, Int32 pageSize,
  43. string sortField, Int32 sortDirection, string[] sumFields,
  44. string staffId,
  45. [FromBody]dynamic data,
  46. bool timeout = false,
  47. bool belowlimit = false,
  48. bool all = false)
  49. {
  50. string userids = getStaff("userid");
  51. string RoleId = getStaff("roleid");
  52. //判断参数是否合法
  53. if (string.IsNullOrEmpty(userids))
  54. {
  55. return Json(new
  56. {
  57. items = new string[] { },
  58. sum = new { },
  59. totalCount = -1,
  60. timeout = 1,
  61. });
  62. }
  63. if (data != null)
  64. {
  65. //Newtonsoft.Json.Linq.JArray
  66. filters = data.filters.ToObject<QueryFilter[]>();
  67. pageIndex = data.pageIndex;
  68. pageSize = data.pageSize;
  69. sortField = data.sortField;
  70. sortDirection = data.sortDirection;
  71. sumFields = data.sumFields.ToObject<string[]>();
  72. }
  73. #region 获取推送记录
  74. DataTable dt = new DataTable();
  75. string result;
  76. //filter参数
  77. string filterstr = "";
  78. List<SqlParameter> parameters = new List<SqlParameter>();
  79. filterstr += QueryFilter.getFilterSqlParam(filters, out parameters, new PushRecordExt(), "B.");
  80. filterstr = filterstr.Replace("B.AccountRealName", "isnull(C.AccountRealName,D.Contact)");
  81. if (timeout)
  82. filterstr += " and datediff( hour, B.CreationTime, getdate() ) >= 6";
  83. if (belowlimit)
  84. filterstr += " and exists (select A1.PushRecordId from " + Config.TablePrefix + "PushFeedback A1 where A1.PushRecordId = B.Id and A1.State=2)";
  85. if (all)
  86. filterstr += "";
  87. //string filterPurrole = FilterRuleByPur.getRolePermFilter(RoleId, " and B.CreationPerson = '" + userids + "' ");
  88. string StaffDocId = StaffDocDAL.GetStaffId(userids);
  89. //string filterPurrole = FilterRuleByPur.getRolePermFilter(RoleId, " and B.ContactId in " +
  90. // "(select K1.ContactId from K_contactsp K1 " +//left join ContactDoc A1 on K1.ContactId = A1.ContactId and A1.EntId = K1.EntId
  91. // " where K1.SaleManId = '" + StaffDocId + "')");
  92. string direct = " desc ";
  93. if (sortDirection != 1)
  94. direct = " asc";
  95. int start = (pageIndex - 1) * pageSize;
  96. int end = (start + 1 + pageSize);
  97. string filterPurrole = FilterTranslator.ruleSql(ref parameters);
  98. string commandText0 = "select * from ";
  99. string commandText1 = "(" +
  100. "select B.*,isnull(C.AccountRealName,D.Contact) as AccountRealName," +
  101. "row_number() over" +
  102. "( order by " + sortField + " " + direct + " ) as rownum from " +
  103. Config.TablePrefix + "PushRecord as B " +
  104. " left join sup_Account C on B.PushAccountId = C.Id " +
  105. " left join ContactDoc D on D.EntId = B.EntId and D.ContactId = B.ContactId" +
  106. " where 1=1 " +
  107. //"exists(" + " select * from " + Config.TablePrefix + "PushFeedback A " +
  108. // " where A.PushRecordId = B.Id)" +
  109. filterstr +
  110. //"and K1.SaleManId = 'K2L78RVHTD7'" +
  111. filterPurrole +
  112. ")AAA ";
  113. string commandText = commandText0 + commandText1 + " where AAA.rownum>" + start + " and AAA.rownum<" + end;
  114. bool success = DataAccess.GetValues(commandText, ref dt, parameters.ToArray(), out result);
  115. // 把DataTable转换为IList<UserInfo>
  116. IList<PushRecordExt> users = new List<PushRecordExt>();
  117. if (dt != null && dt.Rows.Count > 0)
  118. {
  119. // 把DataTable转换为IList<UserInfo>
  120. users = ModelConvertHelper<PushRecordExt>.ConvertToModel(dt);
  121. }
  122. #endregion
  123. IsoDateTimeConverter timejson = new IsoDateTimeConverter
  124. {
  125. DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss"
  126. };
  127. var jsonData = JsonConvert.SerializeObject(users, timejson);
  128. string result1;
  129. string commandTextCount = "select count(Id) from " + commandText1;
  130. long totalcount = DataAccess.GetRowCountDefine(commandTextCount, parameters.ToArray(), out result1);
  131. return Json(new
  132. {
  133. items = JsonConvert.DeserializeObject(jsonData),
  134. sum = new { },
  135. totalCount = totalcount
  136. });
  137. }
  138. //查看供应商业务员提交的供货情况--供应商业务员未提交的
  139. [AuthPermission]
  140. [HttpPost, Route("pushfeedback/{state}/{staffId}")]
  141. public ActionResult PushFeedback(QueryFilter[] filters, Int32 pageIndex, Int32 pageSize,
  142. string sortField, Int32 sortDirection, string[] sumFields,
  143. String state,
  144. string staffId,
  145. [FromBody]dynamic data)
  146. {
  147. string userids = getStaff("userid");
  148. string RoleId = getStaff("roleid");
  149. //判断参数是否合法
  150. if (string.IsNullOrEmpty(userids))
  151. {
  152. return Json(new
  153. {
  154. items = new string[] { },
  155. sum = new { },
  156. totalCount = -1,
  157. timeout = 1,
  158. });
  159. }
  160. if (data != null)
  161. {
  162. //Newtonsoft.Json.Linq.JArray
  163. filters = data.filters.ToObject<QueryFilter[]>();
  164. pageIndex = data.pageIndex;
  165. pageSize = data.pageSize;
  166. sortField = data.sortField;
  167. sortDirection = data.sortDirection;
  168. sumFields = data.sumFields.ToObject<string[]>();
  169. }
  170. #region 获取推送记录明细
  171. DataTable dt = new DataTable();
  172. string result = string.Empty;
  173. string direct = " desc ";
  174. if (sortDirection != 1)
  175. direct = " asc";
  176. int start = (pageIndex - 1) * pageSize;
  177. int end = (start + 1 + pageSize);
  178. string filter = string.Empty;
  179. if (state == null || state == "")
  180. filter = " and " + " A.State IS NULL OR A.State in (0,5) ";
  181. else if (state == "0,5")
  182. filter = " and " + " A.State IS NULL OR A.State in (0,5)";
  183. else if (state == "5,6")
  184. filter = " R A.State in (5,6)";
  185. else if (state == "0,5,6")
  186. filter = " and " + " A.State IS NULL OR A.State in (0,5,6)";
  187. else if (state == "999")
  188. filter = " and " + " A.State in (0,5,6) and datediff( hour, A.CreationTime, getdate() ) >= 6";
  189. else if (state == "1")
  190. filter = " and " + " A.State = 1";
  191. else if (state == "1,2")
  192. filter = " and " + " A.State in (1,2)";
  193. else if (state == "3")
  194. filter = " and " + " A.State = 3";
  195. else if (state == "4")
  196. filter = " and " + " A.State = 4";
  197. else if (state == "all")
  198. filter = "";
  199. else
  200. filter = " and " + " A.State = " + state;
  201. //string filterPurrole = FilterRuleByPur.getRolePermFilter(RoleId, " and A.CreationPerson = '" + userids + "' ");
  202. string StaffDocId = StaffDocDAL.GetStaffId(userids);
  203. //string filterPurrole = FilterRuleByPur.getRolePermFilter(RoleId, " and B.ContactId in " +
  204. // "(select K1.ContactId from K_contactsp K1 " +// left join ContactDoc A1 on A1.EntId=K1.EntId and K1.ContactId = A1.ContactId
  205. // " where K1.SaleManId = '" + StaffDocId + "')");
  206. //filter参数
  207. List<SqlParameter> parameters1 = new List<SqlParameter>();
  208. string filterstr = QueryFilter.getFilterSqlParam(filters, out parameters1, new PushFeedbackExt(), "A.");
  209. if (filterstr.IndexOf("AccountRealName") > 0)
  210. {
  211. filterstr = filterstr.Replace("and A.AccountRealName", "and isnull(C.AccountRealName,D0.Contact)");
  212. }
  213. else if (filterstr.IndexOf("DiffHour") > 0)
  214. {
  215. filterstr = filterstr.Replace("and A.DiffHour", "and CAST(datediff( hour, A.CreationTime, getdate() ) as decimal)");
  216. }
  217. filterstr = filterstr.Replace("and A.CentPayMd", "and D.CentPayMd ");
  218. filterstr = filterstr.Replace("and A.ReceiptMd", "and D.ReceiptMd ");
  219. filterstr = filterstr.Replace("and A.RequestDate", "and CONVERT(datetime,D.EndDate,101) ");
  220. filter += filterstr;
  221. filter = filter.Replace("A.IsPrepayI", " Case D.IsPrepay When 'Y' Then 1 Else 0 End ");
  222. filter = filter.Replace("A.PrepayAmt", "D.PrepayAmt");
  223. string filterPurrole = FilterTranslator.ruleSql(ref parameters1);
  224. string commandText0 = "select * from (";
  225. string commandText1 = "select A.*,'' as OrgId,'' as DepId," +
  226. "isnull(C.AccountRealName,D0.Contact) as AccountRealName," +
  227. " CAST(datediff( hour, A.CreationTime, getdate() ) as decimal) as DiffHour, " +
  228. (state != "3" && state != "4" ? "" : "D.CentPayMd,D.ReceiptMd," +
  229. "CASE D.EndDate WHEN '0001-01-01' THEN null ELSE CONVERT(datetime,D.EndDate,101) END as RequestDate," +
  230. "Case D.IsPrepay When 'Y' Then 1 Else 0 End IsPrepayI,D.PrepayAmt,"
  231. ) +
  232. "'盒' as Unit,F.WmsMeas," +
  233. "row_number() over" +
  234. "( order by A." + sortField + direct + " ) as rownum";
  235. string commandText2 = " from " + Config.TablePrefix + "PushFeedback A left join " + Config.TablePrefix + "PushRecord B on A.PushRecordId = B.Id " +
  236. " left join " + Config.TablePrefix + "Account C on C.Id = A.PushAccountId " +
  237. " left join ContactDoc D0 on D0.EntId = A.EntId and D0.ContactId = A.ContactId " +
  238. (state != "3" && state != "4" ? "" : " left join PurPlanMT D on D.EntId = B.EntId and D.PushRecordId = B.Id and D.K_ContactId = A.ContactId and D.BillState=0 ") +
  239. //" left join PGPrice E on E.EntId = A.EntId and E.GoodsId = A.GoodsId " +
  240. " left join GoodsAttr F on F.EntId = A.EntId and F.GoodsId = A.GoodsId " +
  241. " where 1 = 1 " +
  242. (state != "3" && state != "4" ? "" : " and D.BillState=0 ") +
  243. filter +
  244. filterPurrole +
  245. "";
  246. string commandText = commandText0 + commandText1 + commandText2 + ")AAA where AAA.rownum>" + start + " and AAA.rownum<" + end
  247. ;
  248. //string connectstr = "Data Source =192.168.50.30; Initial Catalog = LJHYBZK; Persist Security Info = True; User ID = sa; Password = xq!@#2014;Pooling=true;MAX Pool Size=512;Min Pool Size=50;Connection Lifetime=30";
  249. bool success = DataAccess.GetValues(commandText, ref dt, parameters1.ToArray(), out result);
  250. #endregion
  251. // 把DataTable转换为IList<UserInfo>
  252. IList<PushFeedbackExt> users = new List<PushFeedbackExt>();
  253. if (dt != null && dt.Rows.Count > 0)
  254. {
  255. // 把DataTable转换为IList<UserInfo>
  256. users = ModelConvertHelper<PushFeedbackExt>.ConvertToModel(dt);
  257. foreach (PushFeedbackExt pfbe in users)
  258. {
  259. pfbe.ContactId = pfbe.ContactId + "_" + pfbe.SuppliersId + "_" + pfbe.PushAccountId;
  260. }
  261. }
  262. IsoDateTimeConverter timejson = new IsoDateTimeConverter
  263. {
  264. DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss"
  265. };
  266. var jsonData = JsonConvert.SerializeObject(users, timejson);
  267. string result1;
  268. string commandTextCount = "select count(*) " + commandText2;
  269. long totalcount = DataAccess.GetRowCountDefine(commandTextCount, parameters1.ToArray(), out result1);
  270. return Json(new
  271. {
  272. items = JsonConvert.DeserializeObject(jsonData),
  273. sum = new { },
  274. totalCount = totalcount
  275. });
  276. }
  277. [AuthPermission]
  278. [HttpPost, Route("exportexcel")]
  279. public ActionResult exportExcel([FromServices]IHostingEnvironment env, string filter, string staffId,string size, string index)
  280. {
  281. string userids;
  282. string RoleId = getStaff("roleid");
  283. userids = getStaffUserid(staffId);
  284. //判断参数是否合法
  285. if (string.IsNullOrEmpty(userids))
  286. {
  287. return Json(new
  288. {
  289. success = false,
  290. msg = "没有登录"
  291. });
  292. }
  293. #region 获取推送记录明细
  294. DataTable dt = new DataTable();
  295. string result;
  296. string direct = " desc ";
  297. if (0 != 1) {
  298. direct = " asc";
  299. }
  300. string StaffDocId = StaffDocDAL.GetStaffId(userids);
  301. string filterPurrole = FilterRuleByPur.getRolePermFilter(RoleId, " and B.PushAccountId in (select userid from K_contactsp K1 left join ContactDoc A1 on K1.ContactId = A1.ContactId " +
  302. " and K1.SaleManId = '" + StaffDocId + "')");
  303. List<SqlParameter> parameters2;
  304. //filter参数
  305. QueryFilter[] filters = JsonConvert.DeserializeObject<QueryFilter[]>(filter);
  306. String filterstr1 = QueryFilter.getFilterSqlParam(filters, out parameters2, new Temp());
  307. //String filterstr = "((State != 0 OR State IS NOT NULL) OR ( State NOT in(5,6)))" +
  308. // " AND PushAccountId != " + userids +
  309. //" AND IsCancel = 0 " + filterstr1;//不包含取消的
  310. List<List<Object>> parameters = new List<List<Object>>();
  311. //parameters.Add(new List<Object>() { "PushFbAccountId", Convert.ToInt32(userids) });
  312. //添加查询条件
  313. if (!string.IsNullOrEmpty(filter)&&filter!= "[]")
  314. {
  315. parameters.Add(new List<Object>() { filters[0].field+"_0", "%"+filters[0].value+"%" });
  316. }
  317. List<SqlParameter> parameters1 = DataAccess.ToParameters(parameters);
  318. string commandText0 = "select * from (";
  319. string commandText1 = "select A.*,'' as OrgId,'' as DepId, C.AccountRealName, E.Unit," +
  320. "row_number() over (order by A.Id " + direct + ") as rownum" +
  321. " from " +
  322. Config.TablePrefix + "PushFeedback A " +
  323. " left join " + Config.TablePrefix + "PushRecord B on A.PushRecordId = B.Id" +
  324. " left join " + Config.TablePrefix + "Account C on A.PushAccountId = C.Id" +
  325. " left join PGPrice E on E.EntId = A.EntId and E.GoodsId = A.GoodsId" +
  326. " where 1 = 1 and A.state = '2'" + filterstr1 + ")AAA ";
  327. //对查询结果进行分页
  328. string commandText2= "";
  329. if (!string.IsNullOrEmpty(size)&& !string.IsNullOrEmpty(index))
  330. {
  331. if (index == "1")
  332. {
  333. commandText2 = " WHERE rownum>=1 and rownum<="+size;
  334. }
  335. else
  336. {
  337. commandText2 = " WHERE rownum>="+ Convert.ToInt32(index) * Convert.ToInt32(size) +"and rownum<"+Convert.ToInt32(size) * (Convert.ToInt32(index)+1);
  338. }
  339. }
  340. string commandText = commandText0 + commandText1+ commandText2;
  341. bool success = DataAccess.GetValues(commandText, ref dt, parameters1.ToArray(), out result);
  342. //result = DataAccess.GetDataTable(Config.TablePrefix + "PushFeedback", "Id", "*", fieldFilter, "", sortField + direct, pageIndex, pageSize != 0 ? pageSize : Config.PageSize);
  343. // 把DataTable转换为IList<UserInfo>
  344. IList<PushRecordExcel> users = new List<PushRecordExcel>();
  345. if (dt != null && dt.Rows.Count > 0)
  346. {
  347. // 把DataTable转换为IList<UserInfo>
  348. users = ModelConvertHelper<PushRecordExcel>.ConvertToModel(dt);
  349. }
  350. #endregion
  351. var mapper = new Mapper();
  352. //var fileName = Path.Combine("excel", RecordId + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx");
  353. var fileName = Path.Combine("excel", "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
  354. mapper
  355. .Map<PushRecordExcel>("推送时间", o => o.CreationTime)
  356. .Map<PushRecordExcel>("业务员", o => o.AccountRealName)
  357. .Map<PushRecordExcel>("商品编码", o => o.GoodsCode)
  358. .Map<PushRecordExcel>("商品名称", o => o.GoodsName)
  359. .Map<PushRecordExcel>("业务员备注", o => o.Feedback)
  360. .Map<PushRecordExcel>("订货数量", o => o.StoreGapNum)
  361. .Map<PushRecordExcel>("库存缺口总数", o => o.PurchaseTotalNum)
  362. .Map<PushRecordExcel>("标准进价", o => o.ActPrice)
  363. .Map<PushRecordExcel>("实际进价", o => o.PurPrice)
  364. .Map<PushRecordExcel>("供应商编码", o => o.BusinessCode)
  365. .Map<PushRecordExcel>("品牌名称", o => o.BrandName)
  366. .Map<PushRecordExcel>("商品规格", o => o.GoodsSpec)
  367. .Map<PushRecordExcel>("生产厂家", o => o.Manufacturer)
  368. .Map<PushRecordExcel>("备注", o => o.Remark)
  369. //.Save(Path.Combine(env.WebRootPath, fileName), users, "newSheet", overwrite: true);
  370. .Save(Path.Combine(env.WebRootPath, fileName), users, "newSheet", overwrite: true, xlsx: false);
  371. byte[] fileBytes = System.IO.File.ReadAllBytes(Path.Combine(env.WebRootPath, fileName));
  372. System.IO.File.Delete(env.WebRootPath + Path.DirectorySeparatorChar + fileName);
  373. return File(fileBytes, "application/ms-excel", DateTime.Now.ToString("MMddHHmmss") + ".xls");
  374. }
  375. ////手动保存并推送:
  376. //[HttpPost, Route("saveandpush")]
  377. //public ActionResult SaveAndPush(
  378. // string Id,
  379. // string PushAccountId,
  380. // string ContactId,
  381. // string GoodsId, string GoodsCode
  382. // , string GoodsName, decimal StoreGapNum
  383. // , string GoodsSpec, string Manufacturer
  384. // , string BusinessId, string BusinessCode, string BusinessName
  385. // , string SuppliersId, string BrandName, string BrandId
  386. // , decimal PurchaseTotalNum, Decimal PurPrice
  387. // , string EntId, string Remark
  388. // , string LoginAccountId,
  389. // [FromBody]dynamic data)
  390. //{
  391. // string FeedbackId = null;
  392. // if (data != null)
  393. // {
  394. // //Newtonsoft.Json.Linq.JArray
  395. // Id = data.Id;
  396. // if (Id != null)
  397. // FeedbackId = Id;
  398. // PushAccountId = data.PushAccountId == null ? null : data.PushAccountId;
  399. // if (PushAccountId == null)
  400. // PushAccountId = data.UserId == null ? null :data.UserId;
  401. // PushAccountId = PushAccountId.Trim();
  402. // GoodsId = data.GoodsId;
  403. // GoodsCode = data.GoodsCode;
  404. // GoodsName = data.GoodsName;
  405. // StoreGapNum = data.StoreGapNum == null ? 0 : data.StoreGapNum;
  406. // GoodsSpec = data.GoodsSpec;
  407. // Manufacturer = data.Manufacturer;
  408. // BusinessId = data.BusinessId;
  409. // BusinessCode = data.BusinessCode;
  410. // BusinessName = data.BusinessName;
  411. // SuppliersId = data.SuppliersId;
  412. // BrandName = data.BrandName;
  413. // BrandId = data.BrandId;
  414. // PurchaseTotalNum = data.PurchaseTotalNum == null ? 0 : data.PurchaseTotalNum;
  415. // PurPrice = data.PurPrice ==null?0 : data.PurPrice;
  416. // BrandId = data.BrandId;
  417. // if (PurPrice.Equals(0))
  418. // PurPrice = data.LastPrice;
  419. // EntId = data.EntId;
  420. // Remark = data.Remark;
  421. // LoginAccountId = data.LoginAccountId;
  422. // }
  423. // if (PushAccountId == null || PushAccountId == "")
  424. // {
  425. // return Json(new
  426. // {
  427. // success = 0,
  428. // msg = "不能推送,请先建立账户!"
  429. // });
  430. // }
  431. // //添加推送记录
  432. // string PushCode = RandHelper.GetTimeRandId().ToString();
  433. // IDictionary<string, Object> successs =
  434. // PushRecordDAL.AddPushRecord(PushCode,
  435. // Convert.ToInt32(PushAccountId),
  436. // ContactId,
  437. // Remark,LoginAccountId);
  438. // Object successRecord = 0;
  439. // successs.TryGetValue("successRecord", out successRecord);
  440. // Object resultRecord = "";
  441. // successs.TryGetValue("resultRecord", out resultRecord);
  442. // Object successRecord1 = 0;
  443. // Object resultRecord1 = "";
  444. // Message msg = null;
  445. // if ((int)successRecord > 0)
  446. // {
  447. // Object recordId;
  448. // successs.TryGetValue("PushRecordId", out recordId);
  449. // string PushRecordId = ((Guid)recordId).ToString();
  450. // //添加或修改推送明细
  451. // IDictionary<string, Object> successs1 =
  452. // PushRecordDAL.AddOrUpdatePushFeedBack(
  453. // PushCode,
  454. // PushRecordId,
  455. // FeedbackId,
  456. // Convert.ToInt32(PushAccountId),
  457. // ContactId,
  458. // GoodsId, GoodsCode
  459. // , GoodsName, StoreGapNum
  460. // , GoodsSpec, Manufacturer
  461. // , BusinessId, BusinessCode, BusinessName
  462. // , SuppliersId, BrandName, BrandId
  463. // , EntId, Remark
  464. // , LoginAccountId, PurPrice, PurchaseTotalNum);
  465. // successs1.TryGetValue("successRecord", out successRecord1);
  466. // successs1.TryGetValue("resultRecord", out resultRecord1);
  467. // //手动推送
  468. // DateTime EndTime = DateTime.Now.AddHours((double)24);
  469. // msg = TimeTask.sendSupplyMassMesage(_client,
  470. // Convert.ToInt32(PushAccountId),
  471. // PushRecordId,
  472. // GoodsName,
  473. // //StoreGapNum,
  474. // //GoodsSpec,
  475. // //BrandName,
  476. // //PurPrice,
  477. // EndTime);
  478. // }
  479. // return Json(new
  480. // {
  481. // success = 1,
  482. // successRecord = successRecord,
  483. // resultRecord = resultRecord,
  484. // successRecord1 = successRecord1,
  485. // resultRecord1 = resultRecord1,
  486. // pushmsg = msg,
  487. // });
  488. //}
  489. //查看商品存储上下限,缺口数量
  490. [AuthPermission]
  491. [HttpPost, Route("storlimit")]
  492. public ActionResult StorLimit(QueryFilter[] filters, Int32 pageIndex, Int32 pageSize,
  493. string sortField, Int32 sortDirection, string[] sumFields, [FromBody]dynamic data)
  494. {
  495. if (data != null)
  496. {
  497. //Newtonsoft.Json.Linq.JArray
  498. filters = data.filters.ToObject<QueryFilter[]>();
  499. pageIndex = data.pageIndex;
  500. pageSize = data.pageSize;
  501. sortField = data.sortField;
  502. sortDirection = data.sortDirection;
  503. sumFields = data.sumFields.ToObject<string[]>();
  504. }
  505. #region 获取库存低于下限记录
  506. DataTable dt = new DataTable();
  507. string result;
  508. string connectstr = "Data Source =192.168.50.30; Initial Catalog = LJHYBZK; Persist Security Info = True; User ID = sa; Password = xq!@#2014;Pooling=true;MAX Pool Size=512;Min Pool Size=50;Connection Lifetime=30";
  509. string direct = " desc ";
  510. if (sortDirection != 1)
  511. direct = " asc";
  512. int start = (pageIndex - 1) * pageSize;
  513. int end = (start + 1 + pageSize);
  514. List<SqlParameter> parameters1 = new List<SqlParameter>();
  515. string filter = QueryFilter.getFilterSqlParam(filters, out parameters1,new PushStorLimit());
  516. string commandText0 = "select * from ";
  517. string commandText1 = "(select *, row_number() over" +
  518. "( order by "+ sortField + direct + " ) as rownum" +
  519. " from " + Config.TablePrefix + "PushStorLimit " +
  520. " where 1=1 "+ filter +
  521. ")AAA";
  522. string commandText = commandText0 + commandText1 + " where AAA.rownum>" + start + " and AAA.rownum<" + end +
  523. " ";
  524. //result = DataAccess.(connectstr,Config.TablePrefix + "PushStorLimit", "GoodsId", "*", " ", "", sortField + direct, pageIndex, pageSize != 0 ? pageSize : Config.PageSize);
  525. bool success = DataAccess.GetValues(connectstr,commandText, ref dt, parameters1.ToArray(), out result);
  526. #endregion
  527. // 把DataTable转换为IList<UserInfo>
  528. IList<PushStorLimit> users = new List<PushStorLimit>();
  529. if (dt!=null && dt.Rows.Count > 0)
  530. {
  531. // 把DataTable转换为IList<UserInfo>
  532. users = ModelConvertHelper<PushStorLimit>.ConvertToModel(dt);
  533. }
  534. IsoDateTimeConverter timejson = new IsoDateTimeConverter
  535. {
  536. DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss"
  537. };
  538. var jsonData = JsonConvert.SerializeObject(users, timejson);
  539. string result1;
  540. string commandTextCount = "select count(*) from "+ commandText1;
  541. int totalcount = DataAccess.GetRowCountDefine(connectstr, commandTextCount, parameters1.ToArray(), out result1);
  542. return Json(new
  543. {
  544. items = JsonConvert.DeserializeObject(jsonData),
  545. sum = new { },
  546. totalCount = totalcount
  547. });
  548. }
  549. //供应商业务员修改过的记录:手动保存并重新推送
  550. //[HttpPost, Route("saveandrepush")]
  551. //public ActionResult SaveAndRePush(
  552. // string Id,
  553. // string PushRecordId,
  554. // string PushCode,
  555. // string PushAccountId,
  556. // string ContactId,
  557. // string GoodsId, string GoodsCode
  558. // , string GoodsName, Decimal StoreGapNum
  559. // , string GoodsSpec, string Manufacturer
  560. // , string BusinessId, string BusinessCode, string BusinessName
  561. // , string SuppliersId, string BrandName, string BrandId
  562. // , Decimal PurchaseTotalNum, Decimal PurPrice
  563. // , string EntId, string Remark, string LoginAccountId,
  564. // [FromBody]dynamic data,
  565. // int ispush = 1)
  566. //{
  567. // string FeedbackId = string.Empty;
  568. // if (data != null)
  569. // {
  570. // //Newtonsoft.Json.Linq.JArray
  571. // Id = data.Id;
  572. // if (Id != null)
  573. // FeedbackId = Id;
  574. // PushRecordId = data.PushRecordId;
  575. // PushAccountId = data.PushAccountId;
  576. // if (PushAccountId == null)
  577. // PushAccountId = data.UserId;
  578. // GoodsId = data.GoodsId;
  579. // GoodsCode = data.GoodsCode;
  580. // GoodsName = data.GoodsName;
  581. // StoreGapNum = data.StoreGapNum;
  582. // GoodsSpec = data.GoodsSpec;
  583. // Manufacturer = data.Manufacturer;
  584. // BusinessId = data.BusinessId;
  585. // BusinessCode = data.BusinessCode;
  586. // BusinessName = data.BusinessName;
  587. // SuppliersId = data.SuppliersId;
  588. // BrandName = data.BrandName;
  589. // BrandId = data.BrandId;
  590. // PurchaseTotalNum = data.PurchaseTotalNum;
  591. // PurPrice = data.PurPrice;
  592. // BrandId = data.BrandId;
  593. // if (PurPrice.Equals(0))
  594. // PurPrice = data.LastPrice!=null?data.LastPrice:0;
  595. // EntId = data.EntId;
  596. // Remark = data.Remark;
  597. // LoginAccountId = data.LoginAccountId;
  598. // ContactId = data.ContactId;
  599. // PushCode = data.PushCode;
  600. // ispush = data.ispush == null ? 1 : data.ispush;//默认推送
  601. // }
  602. // if (PushAccountId == null || PushAccountId == "")
  603. // {
  604. // return Json(new
  605. // {
  606. // success = 0,
  607. // msg = "不能推送,请先建立账户!"
  608. // });
  609. // }
  610. // //else
  611. // //{
  612. // // return Json(new
  613. // // {
  614. // // success = 0,
  615. // // msg = "不能推送,请先提醒对方业务员绑定!"
  616. // // });
  617. // //}
  618. // //手动推送
  619. // Message msg = null;
  620. // Object recordId;
  621. // Object successRecord = 0;
  622. // Object resultRecord = "";
  623. // //根据userid 初始化PushAccountId
  624. // //ContactDoc cdoc = AccountDAL.getContactor(ContactId);
  625. // Dictionary<string, PushStorLimit> gapnum;
  626. // string[] ContactIds = ContactId.Split("_");
  627. // if (ContactIds.Length > 1)
  628. // {
  629. // ContactId = ContactIds[0];
  630. // SuppliersId = ContactIds[1];
  631. // PushAccountId = ContactIds[2];
  632. // }
  633. // if (PushAccountId == null || PushAccountId == "")
  634. // {
  635. // return Json(new
  636. // {
  637. // success = 0,
  638. // msg = "不能推送,请先建立业务员账户!"
  639. // });
  640. // }
  641. // if (ispush > 0 && (PushRecordId == null || PushRecordId == "")) {
  642. // DateTime EndTime = DateTime.Now.AddHours((double)24);
  643. // //手动推送
  644. // msg = TimeTask.sendSupplyMassMesage(_client,
  645. // Convert.ToInt32(PushAccountId),
  646. // PushRecordId,
  647. // GoodsName,
  648. // //StoreGapNum,
  649. // //GoodsSpec,
  650. // //BrandName,
  651. // //PurPrice,
  652. // EndTime);
  653. // //添加推送记录
  654. // PushCode = RandHelper.GetTimeRandId().ToString();
  655. // IDictionary<string, Object> successs =
  656. // PushRecordDAL.AddPushRecord(PushCode,
  657. // Convert.ToInt32(PushAccountId), ContactId, Remark
  658. // , LoginAccountId);
  659. // successs.TryGetValue("successRecord", out successRecord);
  660. // successs.TryGetValue("resultRecord", out resultRecord);
  661. // successs.TryGetValue("PushRecordId", out recordId);
  662. // }
  663. // else
  664. // {
  665. // recordId = Guid.Parse(PushRecordId);
  666. // successRecord = 1;
  667. // }
  668. // Object successRecord1 = 0;
  669. // Object resultRecord1 = "";
  670. // if ((int)successRecord > 0) {
  671. // PushRecordId = ((Guid)recordId).ToString();
  672. // //添加或修改推送明细
  673. // IDictionary<string, Object> successs1 =
  674. // PushRecordDAL.AddOrUpdatePushFeedBack(
  675. // PushCode,
  676. // PushRecordId,
  677. // FeedbackId,
  678. // Convert.ToInt32(PushAccountId),
  679. // ContactId,
  680. // GoodsId, GoodsCode
  681. // , GoodsName, StoreGapNum
  682. // , GoodsSpec, Manufacturer
  683. // , BusinessId, BusinessCode, BusinessName
  684. // , SuppliersId, BrandName, BrandId
  685. // , EntId, Remark
  686. // , LoginAccountId, PurPrice, PurchaseTotalNum);
  687. // successs1.TryGetValue("successRecord", out successRecord1);
  688. // successs1.TryGetValue("resultRecord", out resultRecord1);
  689. // }
  690. // return Json(new
  691. // {
  692. // success = 1,
  693. // successRecord = successRecord,
  694. // resultRecord = resultRecord,
  695. // successRecord1 = successRecord1,
  696. // resultRecord1 = resultRecord1,
  697. // pushmsg = msg,
  698. // });
  699. //}
  700. ////查看供应商业务员提交的供货情况--业务员已修改的
  701. //[HttpPost, Route("pushfeedbackconfirm")]
  702. //public ActionResult PushFeedbackConfirm(QueryFilter[] filters, Int32 pageIndex, Int32 pageSize,
  703. // string sortField, Int32 sortDirection, string[] sumFields,
  704. // [FromBody]dynamic data)
  705. //{
  706. // return this.PushFeedback(filters, pageIndex, pageSize,
  707. // sortField, sortDirection, sumFields,
  708. // "2",
  709. // data);
  710. //}
  711. ////查看供应商业务员提交的供货情况-业务员已提交的
  712. //[HttpPost, Route("pushfeedbackconfirmed")]
  713. //public ActionResult PushFeedbackConfirmed(QueryFilter[] filters, Int32 pageIndex, Int32 pageSize,
  714. // string sortField, Int32 sortDirection, string[] sumFields,
  715. // [FromBody]dynamic data)
  716. //{
  717. // return this.PushFeedback(filters, pageIndex, pageSize,
  718. // sortField, sortDirection, sumFields,
  719. // "1,2",
  720. // data);
  721. //}
  722. ///保存到采购计划
  723. //[HttpPost, Route("savetoplan")]
  724. //public ActionResult SaveToPlan(
  725. // string Id,string PushRecordId,
  726. // string PushAccountId,
  727. // string EntId, int ReceiptMd, int CentPayMd
  728. // , string OrgId, string DeptId
  729. // , string FeedBack, string Remark
  730. // , string GoodsId, string SuppliersId
  731. // , string BusinessId, string BusinessCode
  732. // , string LoginAccountId,
  733. // string GoodsSpec, Int32 GoodsGapNum,
  734. // Decimal PurPrice, string Remark1,
  735. // Int32 PurchaseTotalNum, Int32 SafeDays
  736. // , DateTime RequestDate,
  737. // [FromBody]dynamic data)
  738. //{
  739. // if (data != null)
  740. // {
  741. // //Newtonsoft.Json.Linq.JArray
  742. // Id = data.Id;
  743. // PushRecordId = data.PushRecordId;
  744. // PushAccountId = data.PushAccountId;
  745. // EntId = data.EntId;
  746. // ReceiptMd = data.ReceiptMd;
  747. // CentPayMd = data.CentPayMd;
  748. // OrgId = data.OrgId;
  749. // DeptId = data.DeptId;
  750. // FeedBack = data.FeedBack;
  751. // Remark = data.Remark;
  752. // GoodsId = data.GoodsId;
  753. // SuppliersId = data.SuppliersId;
  754. // BusinessId = data.BusinessId;
  755. // BusinessCode = data.BusinessCode;
  756. // LoginAccountId = data.LoginAccountId;
  757. // GoodsSpec = data.GoodsSpec;
  758. // GoodsGapNum = data.StoreGapNum;
  759. // PurPrice = data.PurPrice;
  760. // Remark1 = data.Remark1;
  761. // PurchaseTotalNum = data.PurchaseTotalNum;
  762. // SafeDays = data.SafeDays;
  763. // }
  764. // PushRecord rec = PushRecordDAL.GetRecord(PushRecordId);
  765. // if (rec!=null &&rec.IsComplete == 1)
  766. // return Json(new
  767. // {
  768. // success = 0,
  769. // msg = "已经生成采购计划!"
  770. // });
  771. // Decimal LastPrice = PurPrice;
  772. // string Summaries = FeedBack;
  773. // DateTime EndTime = DateTime.Now.AddHours((double)24);
  774. // string LoginStaffId = StaffDocDAL.GetStaffId(LoginAccountId);
  775. // //添加采购计划
  776. // IDictionary<string, Object> successs =
  777. // PushRecordDAL.AddPlan(rec.Id.ToString(),Id, Convert.ToInt32(PushAccountId),
  778. // EntId, ReceiptMd, CentPayMd
  779. // , OrgId, DeptId//depid
  780. // , "采购计划", Remark //Summaries
  781. // , GoodsId, SuppliersId
  782. // , BusinessId, BusinessCode
  783. // , LoginStaffId
  784. // , RequestDate);
  785. // int successAll = 0;
  786. // Object successPlan;
  787. // successs.TryGetValue("successRecord", out successPlan);
  788. // if ((int)successPlan > 0) {
  789. // Object PlanBillNo0;
  790. // successs.TryGetValue("PlanBillNo", out PlanBillNo0);
  791. // int PlanBillNo = (int)PlanBillNo0;
  792. // //添加采购计划明细
  793. // IDictionary<string, Object> successs1 =
  794. // PushRecordDAL.AddPlanDT(Id,PlanBillNo, 0,
  795. // GoodsId, GoodsSpec, GoodsGapNum,
  796. // LastPrice, Remark,
  797. // EntId,
  798. // BusinessId, BusinessCode,
  799. // SuppliersId,
  800. // PurchaseTotalNum, SafeDays
  801. // , LoginStaffId
  802. // , RequestDate);
  803. // Object successPlan1;
  804. // successs1.TryGetValue("successRecord", out successPlan1);
  805. // if ((int)successPlan1>0)
  806. // {
  807. // //更新推送状态 生成计划
  808. // string resultState;
  809. // var successState = PurPlanDAL.UpdatePlanState(Id, PushRecordId, LoginAccountId,out resultState);
  810. // if (resultState.StartsWith("在执行数据操作时发生错误"))
  811. // successAll = 1;
  812. // }
  813. // }
  814. // Object successRecord;
  815. // Object resultRecord;
  816. // Object successRecordRelate;
  817. // Object resultRecordRelate;
  818. // successs.TryGetValue("successRecord", out successRecord);
  819. // successs.TryGetValue("resultRecord", out resultRecord);
  820. // successs.TryGetValue("successRecordRelate", out successRecordRelate);
  821. // successs.TryGetValue("resultRecordRelate", out resultRecordRelate);
  822. // Object successRecord1;
  823. // Object resultRecord1;
  824. // Object successRecordRelate1;
  825. // Object resultRecordRelate1;
  826. // successs.TryGetValue("successRecord", out successRecord1);
  827. // successs.TryGetValue("resultRecord", out resultRecord1);
  828. // successs.TryGetValue("successRecordRelate", out successRecordRelate1);
  829. // successs.TryGetValue("resultRecordRelate", out resultRecordRelate1);
  830. // if(successAll > 0) {
  831. // return Json(new
  832. // {
  833. // success = 1,
  834. // successRecord = successRecord,
  835. // resultRecord = resultRecord,
  836. // successRecord1 = successRecord1,
  837. // resultRecord1 = resultRecord1,
  838. // });
  839. // }
  840. // else
  841. // {
  842. // return Json(new
  843. // {
  844. // success = 0,
  845. // successRecord = successRecord,
  846. // resultRecord = resultRecord,
  847. // successRecord1 = successRecord1,
  848. // resultRecord1 = resultRecord1,
  849. // });
  850. // }
  851. //}
  852. //////待推送联系人--所有推送的业务员,查询业务员的推送记录
  853. //[HttpPost, Route("pendingcontacts")]
  854. //public JsonResult PendingContacts(QueryFilter[] filters, Int32 pageIndex, Int32 pageSize,
  855. // string sortField, Int32 sortDirection, string[] sumFields, [FromBody]dynamic data)
  856. //{
  857. // if (data != null)
  858. // {
  859. // //Newtonsoft.Json.Linq.JArray
  860. // filters = data.filters.ToObject<QueryFilter[]>();
  861. // pageIndex = data.pageIndex;
  862. // pageSize = data.pageSize;
  863. // sortField = data.sortField;
  864. // sortDirection = data.sortDirection;
  865. // sumFields = data.sumFields.ToObject<string[]>();
  866. // }
  867. // #region 获取待推联系人
  868. // DataTable dt = new DataTable();
  869. // string result = string.Empty;
  870. // string direct = " desc ";
  871. // if (sortDirection != 1)
  872. // direct = " asc";
  873. // int start = (pageIndex - 1) * pageSize;
  874. // int end = (start + 1 + pageSize);
  875. // List<SqlParameter> parameters1 = new List<SqlParameter>();
  876. // string filterstr = QueryFilter.getFilterSqlParam(filters, out parameters1, new PushContactWithGoods());
  877. // IList<PushContactWithGoods> users = new List<PushContactWithGoods>();
  878. // Int64 totalcount = 0;
  879. // //跨库 获取存储上下限
  880. // IList<PushStorLimit> limits = PushRecordDAL.GetPushLimit();
  881. // if (limits.Count > 0)
  882. // {
  883. // List<string> superior_list = new List<string>(0);
  884. // Dictionary<string, PushStorLimit> gapnum = new Dictionary<string, PushStorLimit>();
  885. // foreach (PushStorLimit limit in limits)
  886. // {
  887. // //Role role;
  888. // //if (roleMap.TryGetValue(permsr.RoleId, out role))
  889. // //{
  890. // // listRoles.Add(role);
  891. // //}
  892. // superior_list.Add(limit.GoodsId);
  893. // gapnum.Add(limit.GoodsId, limit);
  894. // }
  895. // //perms.RoleList = listRoles;
  896. // string limitss = string.Join("','", superior_list.ToArray());
  897. // string commandText0 = "select * from (";
  898. // string commandText1 = "select *, row_number() over" +
  899. // "(order by ContactCode " + direct + " ) as rownum " +
  900. // " FROM(SELECT ROW_NUMBER() OVER(PARTITION BY t1.GoodsId,t1.ContactId ORDER BY t1.SysDates1 desc,t1.LastPrice asc) AS RNUM," +
  901. // " * " +
  902. // "FROM sup_PushContactWithGoods t1" +
  903. // " WHERE exists(" +
  904. // " select 1 from LJHYBZK.dbo.sup_PushStorLimit A " +
  905. // " where A.GoodsId = t1.GoodsId)" +
  906. // //" WHERE t1.GoodsId IN ('" +
  907. // //limitss +
  908. // //" ')" +
  909. // filterstr+
  910. // ") AS T " +
  911. // " WHERE T.RNUM = 1" +
  912. // ")AAA";
  913. // string commandText2 = commandText0 + commandText1+" where AAA.rownum>" + start + " and AAA.rownum<" + end +
  914. // " ";
  915. // //string connectstr = "Data Source =192.168.50.30; Initial Catalog = LJHYBZK; Persist Security Info = True; User ID = sa; Password = xq!@#2014;Pooling=true;MAX Pool Size=512;Min Pool Size=50;Connection Lifetime=30";
  916. // //bool result1 = DataAccess.GetValues(connectstr, commandText, ref dt, parameters1.ToArray(), out result);
  917. // bool result1 = DataAccess.GetValues(commandText2, ref dt, parameters1.ToArray(), out result);
  918. // #endregion
  919. // // 把DataTable转换为IList<UserInfo>
  920. // if (dt != null && dt.Rows.Count > 0)
  921. // {
  922. // // 把DataTable转换为IList<UserInfo>
  923. // users = ModelConvertHelper<PushContactWithGoods>.ConvertToModel(dt);
  924. // foreach (PushContactWithGoods user in users)
  925. // {
  926. // //Role role;
  927. // //if (roleMap.TryGetValue(permsr.RoleId, out role))
  928. // //{
  929. // // listRoles.Add(role);
  930. // //}
  931. // PushStorLimit StorLimit;
  932. // gapnum.TryGetValue(user.GoodsId, out StorLimit);
  933. // user.StoreGapNum = StorLimit.StoreGapNum;
  934. // user.EntId = StorLimit.EntId;
  935. // user.PurchaseTotalNum = StorLimit.PurchaseTotalNum;//StoreGapNum
  936. // }
  937. // }
  938. // string resultrow;
  939. // string commandTextRowCount = "select count(*) from ("+ commandText1;
  940. // //totalcount = DataAccess.GetRowCountDefine(connectstr, commandTextRowCount, out resultrow);
  941. // totalcount = DataAccess.GetRowCountDefine( commandTextRowCount, out resultrow);
  942. // }
  943. // IsoDateTimeConverter timejson = new IsoDateTimeConverter
  944. // {
  945. // DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss"
  946. // };
  947. // var jsonData = JsonConvert.SerializeObject(users, timejson);
  948. // return Json(new
  949. // {
  950. // items = JsonConvert.DeserializeObject(jsonData),
  951. // sum = new { },
  952. // totalCount = totalcount
  953. // });
  954. //}
  955. ///取预付款订单总金额
  956. [HttpGet, Route("PrepayAmt")]
  957. public JsonResult PrepayAmt(string PushRecordId,string BusinessId)
  958. {
  959. string sql = "select sum(ActPrice*StoreGapNum) as PrepayAmt from " + Config.TablePrefix+ "PushFeedback" +
  960. " where PushRecordId = @PushRecordId " +
  961. " and BusinessId = @BusinessId " +
  962. " group by PushRecordId,BusinessId";
  963. string result = string.Empty;
  964. List<SqlParameter> param = new List<SqlParameter>(2);
  965. param.Add(new SqlParameter("PushRecordId", PushRecordId));
  966. param.Add(new SqlParameter("BusinessId", BusinessId));
  967. DataAccess.GetOneValue(sql, param,out var PrepayAmt, out result);
  968. return Json(new
  969. {
  970. success = 1,
  971. sum = PrepayAmt,
  972. msg = result
  973. });
  974. }
  975. }
  976. }