纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8078 lines
327 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. using ICSSoft.DataProject;
  2. using ICSSoft.DataProject.ICSSoft.DataProject;
  3. using ICSSoft.Entity;
  4. using Newtonsoft.Json;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.Linq;
  9. using System.Net;
  10. using System.Net.Http;
  11. using System.Text;
  12. using System.Web.Http;
  13. using System.Web.Http.Description;
  14. using ICSSoft.Common;
  15. using ICSSoft.APIApproveRCV;
  16. using ICSSoft.APIApproveIssue;
  17. using ICSSoft.APICreateIssue;
  18. using ICSSoft.APICreateCompRpt;
  19. using ICSSoft.APIApproveShipment;
  20. using ICSSoft.APIApproveMiscShip;
  21. using ICSSoft.APIApproveMiscRcv;
  22. using ICSSoft.APIApproveTransferIN;
  23. namespace ICSSoft.WebAPI.Controllers
  24. {
  25. public class ValuesController : ApiController
  26. {
  27. private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  28. #region 请购单
  29. /// <summary>
  30. /// 获取请购单
  31. /// </summary>
  32. /// <param name="JsonData"></param>
  33. /// <returns></returns>
  34. [Route("api/PurchaseRequisition/Get")]
  35. [HttpPost]
  36. public HttpResponseMessage GetPurchaseRequisition([FromBody] object JsonData)
  37. {
  38. log.Info("接口:api/PurchaseRequisition/Get ");
  39. log.Info("获取请购单传入值:" + JsonData);
  40. HttpResponseMessage result = new HttpResponseMessage();
  41. Result res = new Result();
  42. string str = string.Empty;
  43. try
  44. {
  45. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  46. {
  47. try
  48. {
  49. List<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>();
  50. try
  51. {
  52. infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(JsonData.ToString());
  53. }
  54. catch (Exception ex)
  55. {
  56. log.Error("转换失败:" + ex.ToString());
  57. res.Success = false;
  58. res.Message = "JSON格式不正确!";
  59. }
  60. PurchaseRequisition action = new PurchaseRequisition();
  61. string resultStr = action.Get(infos);
  62. if (resultStr.Length > 0)
  63. {
  64. res.Success = true;
  65. res.Message = "接口调用成功!";
  66. res.Data = resultStr;
  67. }
  68. else
  69. {
  70. res.Success = false;
  71. res.Message = "接口调用失败";
  72. }
  73. }
  74. catch (Exception ex)
  75. {
  76. log.Error("调用后台失败:" + ex.ToString());
  77. res.Success = false;
  78. res.Message = ex.Message;
  79. }
  80. }
  81. else
  82. {
  83. res.Success = false;
  84. res.Message = "请传入参数";
  85. }
  86. }
  87. catch (Exception ex)
  88. {
  89. log.Error("参数检验失败:" + ex.ToString());
  90. res.Success = false;
  91. res.Message = ex.Message;
  92. }
  93. finally
  94. {
  95. str = JsonConvert.SerializeObject(res);
  96. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  97. }
  98. log.Debug("获取请购单返回值:" + str);
  99. return result;
  100. }
  101. /// <summary>
  102. /// 创建请购单
  103. /// </summary>
  104. /// <param name="JsonData"></param>
  105. /// <returns></returns>
  106. [Route("api/PurchaseRequisition/Create")]
  107. [HttpPost]
  108. public HttpResponseMessage CreatePurchaseRequisition([FromBody] object JsonData)
  109. {
  110. log.Info("接口:api/PurchaseRequisition/Create ");
  111. log.Info("创建请购单传入值:" + JsonData);
  112. HttpResponseMessage result = new HttpResponseMessage();
  113. Result res = new Result();
  114. string str = string.Empty;
  115. try
  116. {
  117. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  118. {
  119. try
  120. {
  121. List<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>();
  122. try
  123. {
  124. infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(JsonData.ToString());
  125. }
  126. catch (Exception ex)
  127. {
  128. log.Error("转换失败:" + ex.ToString());
  129. res.Success = false;
  130. res.Message = "JSON格式不正确!";
  131. throw new Exception(res.Message);
  132. }
  133. PurchaseRequisition action = new PurchaseRequisition();
  134. string resultStr = action.CreatePurchaseRequisition(infos);
  135. if (!string.IsNullOrWhiteSpace(resultStr))
  136. {
  137. res.Success = true;
  138. res.Message = "接口调用成功!";
  139. res.Data = resultStr;
  140. }
  141. else
  142. {
  143. res.Success = false;
  144. res.Data = resultStr;
  145. }
  146. }
  147. catch (Exception ex)
  148. {
  149. log.Error("调用后台失败:" + ex.ToString());
  150. res.Success = false;
  151. res.Message = ex.Message;
  152. }
  153. }
  154. else
  155. {
  156. res.Success = false;
  157. res.Message = "请传入参数";
  158. }
  159. }
  160. catch (Exception ex)
  161. {
  162. log.Error("参数检验失败:" + ex.ToString());
  163. res.Success = false;
  164. res.Message = ex.Message;
  165. }
  166. finally
  167. {
  168. str = JsonConvert.SerializeObject(res);
  169. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  170. }
  171. log.Debug("创建请购单返回值:" + str);
  172. return result;
  173. }
  174. /// <summary>
  175. /// 审核请购单
  176. /// </summary>
  177. /// <param name="JsonData"></param>
  178. /// <returns></returns>
  179. [Route("api/PurchaseRequisition/Approve")]
  180. [HttpPost]
  181. public HttpResponseMessage ApprovePurchaseRequisition([FromBody] object JsonData)
  182. {
  183. log.Info("接口:api/PurchaseRequisition/Approve");
  184. log.Info("审核请购单传入值:" + JsonData);
  185. HttpResponseMessage result = new HttpResponseMessage();
  186. Result res = new Result();
  187. string str = string.Empty;
  188. try
  189. {
  190. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  191. {
  192. try
  193. {
  194. List<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>();
  195. try
  196. {
  197. infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(JsonData.ToString());
  198. }
  199. catch (Exception ex)
  200. {
  201. log.Error("转换失败:" + ex.ToString());
  202. res.Success = false;
  203. res.Message = "JSON格式不正确!";
  204. }
  205. PurchaseRequisition action = new PurchaseRequisition();
  206. string resultStr = action.Approve(infos);
  207. if (string.IsNullOrWhiteSpace(resultStr))
  208. {
  209. res.Success = true;
  210. res.Message = "接口调用成功!";
  211. //res.Data = resultStr;
  212. }
  213. else
  214. {
  215. res.Success = false;
  216. res.Message = "接口调用失败";
  217. }
  218. }
  219. catch (Exception ex)
  220. {
  221. log.Error("调用后台失败:" + ex.ToString());
  222. res.Success = false;
  223. res.Message = ex.Message;
  224. }
  225. }
  226. else
  227. {
  228. res.Success = false;
  229. res.Message = "请传入参数";
  230. }
  231. }
  232. catch (Exception ex)
  233. {
  234. log.Error("参数检验失败:" + ex.ToString());
  235. res.Success = false;
  236. res.Message = ex.Message;
  237. }
  238. finally
  239. {
  240. str = JsonConvert.SerializeObject(res);
  241. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  242. }
  243. log.Debug("审核请购单返回值:" + str);
  244. return result;
  245. }
  246. /// <summary>
  247. /// 删除到货单
  248. /// </summary>
  249. /// <param name="JsonData"></param>
  250. /// <returns></returns>
  251. [Route("api/PurchaseRequisition/Delete")]
  252. [HttpPost]
  253. public HttpResponseMessage DeletePurchaseRequisition([FromBody] object JsonData)
  254. {
  255. log.Info("接口:api/PurchaseRequisition/Delete");
  256. log.Info("删除到货单传入值:" + JsonData);
  257. HttpResponseMessage result = new HttpResponseMessage();
  258. Result res = new Result();
  259. string str = string.Empty;
  260. try
  261. {
  262. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  263. {
  264. try
  265. {
  266. List<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>();
  267. try
  268. {
  269. infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(JsonData.ToString());
  270. }
  271. catch (Exception ex)
  272. {
  273. log.Error("转换失败:" + ex.ToString());
  274. res.Success = false;
  275. res.Message = "JSON格式不正确!";
  276. }
  277. PurchaseRequisition action = new PurchaseRequisition();
  278. string resultStr = action.Delete(infos);
  279. if (string.IsNullOrWhiteSpace(resultStr))
  280. {
  281. res.Success = true;
  282. res.Message = "接口调用成功!";
  283. //res.Data = resultStr;
  284. }
  285. else
  286. {
  287. res.Success = false;
  288. res.Message = "接口调用失败";
  289. }
  290. }
  291. catch (Exception ex)
  292. {
  293. log.Error("调用后台失败:" + ex.ToString());
  294. res.Success = false;
  295. res.Message = ex.Message;
  296. }
  297. }
  298. else
  299. {
  300. res.Success = false;
  301. res.Message = "请传入参数";
  302. }
  303. }
  304. catch (Exception ex)
  305. {
  306. log.Error("参数检验失败:" + ex.ToString());
  307. res.Success = false;
  308. res.Message = ex.Message;
  309. }
  310. finally
  311. {
  312. str = JsonConvert.SerializeObject(res);
  313. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  314. }
  315. log.Debug("删除到货单返回值:" + str);
  316. return result;
  317. }
  318. #endregion
  319. #region 采购订单
  320. /// <summary>
  321. /// 获取采购订单
  322. /// </summary>
  323. /// <param name="JsonData"></param>
  324. /// <returns></returns>
  325. [Route("api/PurchaseOrder/Get")]
  326. [HttpPost]
  327. public HttpResponseMessage GetPurchaseOrder([FromBody] object JsonData)
  328. {
  329. log.Info("接口:api/PurchaseOrder/Get");
  330. log.Info("获取采购订单传入值:" + JsonData);
  331. HttpResponseMessage result = new HttpResponseMessage();
  332. Result res = new Result();
  333. string str = string.Empty;
  334. try
  335. {
  336. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  337. {
  338. try
  339. {
  340. List<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>();
  341. try
  342. {
  343. infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(JsonData.ToString());
  344. }
  345. catch (Exception ex)
  346. {
  347. log.Error("转换失败:" + ex.ToString());
  348. res.Success = false;
  349. res.Message = "JSON格式不正确!";
  350. }
  351. PurchaseOrder action = new PurchaseOrder();
  352. string resultStr = action.GET(infos);
  353. if (resultStr.Length > 0)
  354. {
  355. res.Success = true;
  356. res.Message = "接口调用成功!";
  357. res.Data = resultStr;
  358. }
  359. else
  360. {
  361. res.Success = false;
  362. res.Message = "接口调用失败";
  363. }
  364. }
  365. catch (Exception ex)
  366. {
  367. log.Error("调用后台失败:" + ex.ToString());
  368. res.Success = false;
  369. res.Message = ex.Message;
  370. }
  371. }
  372. else
  373. {
  374. res.Success = false;
  375. res.Message = "请传入参数";
  376. }
  377. }
  378. catch (Exception ex)
  379. {
  380. log.Error("参数检验失败:" + ex.ToString());
  381. res.Success = false;
  382. res.Message = ex.Message;
  383. }
  384. finally
  385. {
  386. str = JsonConvert.SerializeObject(res);
  387. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  388. }
  389. log.Debug("获取采购订单返回值:" + str);
  390. return result;
  391. }
  392. /// <summary>
  393. /// 创建采购订单
  394. /// </summary>
  395. /// <param name="JsonData"></param>
  396. /// <returns></returns>
  397. [Route("api/PurchaseOrder/Create")]
  398. [HttpPost]
  399. public HttpResponseMessage CreatePurchaseOrder([FromBody] object JsonData)
  400. {
  401. log.Info("接口:api/PurchaseOrder/Create");
  402. log.Info("创建采购订单传入值:" + JsonData);
  403. HttpResponseMessage result = new HttpResponseMessage();
  404. Result res = new Result();
  405. string str = string.Empty;
  406. try
  407. {
  408. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  409. {
  410. try
  411. {
  412. List<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>();
  413. try
  414. {
  415. infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(JsonData.ToString());
  416. }
  417. catch (Exception ex)
  418. {
  419. log.Error("转换失败:" + ex.ToString());
  420. res.Success = false;
  421. res.Message = "JSON格式不正确!";
  422. throw new Exception(res.Message);
  423. }
  424. PurchaseOrder action = new PurchaseOrder();
  425. string resultStr = action.CreateICSPurchaseOrder(infos);
  426. if (!string.IsNullOrWhiteSpace(resultStr))
  427. {
  428. res.Success = true;
  429. res.Message = "接口调用成功!";
  430. res.Data = resultStr;
  431. }
  432. else
  433. {
  434. res.Success = false;
  435. res.Data = resultStr;
  436. }
  437. }
  438. catch (Exception ex)
  439. {
  440. log.Error("调用后台失败:" + ex.ToString());
  441. res.Success = false;
  442. res.Message = ex.Message;
  443. }
  444. }
  445. else
  446. {
  447. res.Success = false;
  448. res.Message = "请传入参数";
  449. }
  450. }
  451. catch (Exception ex)
  452. {
  453. log.Error("参数检验失败:" + ex.ToString());
  454. res.Success = false;
  455. res.Message = ex.Message;
  456. }
  457. finally
  458. {
  459. str = JsonConvert.SerializeObject(res);
  460. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  461. }
  462. log.Debug("创建采购订单返回值:" + str);
  463. return result;
  464. }
  465. /// <summary>
  466. /// 审核采购订单
  467. /// </summary>
  468. /// <param name="JsonData"></param>
  469. /// <returns></returns>
  470. [Route("api/PurchaseOrder/Approve")]
  471. [HttpPost]
  472. public HttpResponseMessage ApprovePurchaseOrder([FromBody] object JsonData)
  473. {
  474. log.Info("接口:api/PurchaseOrder/Approve");
  475. log.Info("审核采购订单传入值:" + JsonData);
  476. HttpResponseMessage result = new HttpResponseMessage();
  477. Result res = new Result();
  478. string str = string.Empty;
  479. try
  480. {
  481. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  482. {
  483. try
  484. {
  485. List<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>();
  486. try
  487. {
  488. infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(JsonData.ToString());
  489. }
  490. catch (Exception ex)
  491. {
  492. log.Error("转换失败:" + ex.ToString());
  493. res.Success = false;
  494. res.Message = "JSON格式不正确!";
  495. }
  496. PurchaseOrder action = new PurchaseOrder();
  497. string resultStr = action.Approve(infos);
  498. if (string.IsNullOrWhiteSpace(resultStr))
  499. {
  500. res.Success = true;
  501. res.Message = "接口调用成功!";
  502. //res.Data = resultStr;
  503. }
  504. else
  505. {
  506. res.Success = false;
  507. res.Message = "接口调用失败";
  508. }
  509. }
  510. catch (Exception ex)
  511. {
  512. log.Error("调用后台失败:" + ex.ToString());
  513. res.Success = false;
  514. res.Message = ex.Message;
  515. }
  516. }
  517. else
  518. {
  519. res.Success = false;
  520. res.Message = "请传入参数";
  521. }
  522. }
  523. catch (Exception ex)
  524. {
  525. log.Error("参数检验失败:" + ex.ToString());
  526. res.Success = false;
  527. res.Message = ex.Message;
  528. }
  529. finally
  530. {
  531. str = JsonConvert.SerializeObject(res);
  532. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  533. }
  534. log.Debug("审核采购订单返回值:" + str);
  535. return result;
  536. }
  537. /// <summary>
  538. /// 删除采购订单
  539. /// </summary>
  540. /// <param name="JsonData"></param>
  541. /// <returns></returns>
  542. [Route("api/PurchaseOrder/Delete")]
  543. [HttpPost]
  544. public HttpResponseMessage DeletePurchaseOrder([FromBody] object JsonData)
  545. {
  546. log.Info("接口:api/PurchaseOrder/Delete");
  547. log.Info("删除采购订单传入值:" + JsonData);
  548. HttpResponseMessage result = new HttpResponseMessage();
  549. Result res = new Result();
  550. string str = string.Empty;
  551. try
  552. {
  553. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  554. {
  555. try
  556. {
  557. List<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>();
  558. try
  559. {
  560. infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(JsonData.ToString());
  561. }
  562. catch (Exception ex)
  563. {
  564. log.Error("转换失败:" + ex.ToString());
  565. res.Success = false;
  566. res.Message = "JSON格式不正确!";
  567. }
  568. PurchaseOrder action = new PurchaseOrder();
  569. string resultStr = action.Delete(infos);
  570. if (string.IsNullOrWhiteSpace(resultStr))
  571. {
  572. res.Success = true;
  573. res.Message = "接口调用成功!";
  574. //res.Data = resultStr;
  575. }
  576. else
  577. {
  578. res.Success = false;
  579. res.Message = "接口调用失败";
  580. }
  581. }
  582. catch (Exception ex)
  583. {
  584. log.Error("调用后台失败:" + ex.ToString());
  585. res.Success = false;
  586. res.Message = ex.Message;
  587. }
  588. }
  589. else
  590. {
  591. res.Success = false;
  592. res.Message = "请传入参数";
  593. }
  594. }
  595. catch (Exception ex)
  596. {
  597. log.Error("参数检验失败:" + ex.ToString());
  598. res.Success = false;
  599. res.Message = ex.Message;
  600. }
  601. finally
  602. {
  603. str = JsonConvert.SerializeObject(res);
  604. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  605. }
  606. log.Debug("删除采购订单返回值:" + str);
  607. return result;
  608. }
  609. #endregion
  610. #region 到货单
  611. /// <summary>
  612. /// 获取到货单
  613. /// </summary>
  614. /// <param name="JsonData"></param>
  615. /// <returns></returns>
  616. [Route("api/CreatePOArrive/Get")]
  617. [HttpPost]
  618. public HttpResponseMessage Get([FromBody] object JsonData)
  619. {
  620. log.Info("接口:api/CreatePOArrive/Get");
  621. log.Info("获取到货单传入值:" + JsonData);
  622. HttpResponseMessage result = new HttpResponseMessage();
  623. Result res = new Result();
  624. string str = string.Empty;
  625. try
  626. {
  627. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  628. {
  629. try
  630. {
  631. List<ICSPOArrive> infos = new List<ICSPOArrive>();
  632. try
  633. {
  634. infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(JsonData.ToString());
  635. }
  636. catch (Exception ex)
  637. {
  638. log.Error("转换失败:" + ex.ToString());
  639. res.Success = false;
  640. res.Message = "JSON格式不正确!";
  641. }
  642. CreatePOArrive action = new CreatePOArrive();
  643. string resultStr = action.Get(infos);
  644. if (resultStr.Length > 0)
  645. {
  646. res.Success = true;
  647. res.Message = "接口调用成功!";
  648. res.Data = resultStr;
  649. }
  650. else
  651. {
  652. res.Success = false;
  653. res.Message = "接口调用失败";
  654. }
  655. }
  656. catch (Exception ex)
  657. {
  658. log.Error("调用后台失败:" + ex.ToString());
  659. res.Success = false;
  660. res.Message = ex.Message;
  661. }
  662. }
  663. else
  664. {
  665. res.Success = false;
  666. res.Message = "请传入参数";
  667. }
  668. }
  669. catch (Exception ex)
  670. {
  671. log.Error("参数检验失败:" + ex.ToString());
  672. res.Success = false;
  673. res.Message = ex.Message;
  674. }
  675. finally
  676. {
  677. str = JsonConvert.SerializeObject(res);
  678. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  679. }
  680. log.Debug("获取到货单返回值:" + str);
  681. return result;
  682. }
  683. /// <summary>
  684. /// 创建到货单
  685. /// </summary>
  686. /// <param name="JsonData"></param>
  687. /// <returns></returns>
  688. [Route("api/CreatePOArrive/Create")]
  689. [HttpPost]
  690. public HttpResponseMessage Create([FromBody] object JsonData)
  691. {
  692. log.Info("接口:api/CreatePOArrive/Create");
  693. log.Info("创建到货单传入值:" + JsonData);
  694. HttpResponseMessage result = new HttpResponseMessage();
  695. Result res = new Result();
  696. string str = string.Empty;
  697. try
  698. {
  699. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  700. {
  701. try
  702. {
  703. List<ICSPOArrive> infos = new List<ICSPOArrive>();
  704. try
  705. {
  706. infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(JsonData.ToString());
  707. }
  708. catch (Exception ex)
  709. {
  710. log.Error("转换失败:" + ex.ToString());
  711. res.Success = false;
  712. res.Message = "JSON格式不正确!";
  713. throw new Exception(res.Message);
  714. }
  715. CreatePOArrive action = new CreatePOArrive();
  716. string resultStr = action.CreatePUArrive(infos);
  717. if (resultStr.Length > 0)
  718. {
  719. res.Success = true;
  720. res.Message = "接口调用成功!";
  721. res.Data = resultStr;
  722. }
  723. else
  724. {
  725. res.Success = false;
  726. res.Data = resultStr;
  727. }
  728. }
  729. catch (Exception ex)
  730. {
  731. log.Error("调用后台失败:" + ex.ToString());
  732. res.Success = false;
  733. res.Message = ex.Message;
  734. }
  735. }
  736. else
  737. {
  738. res.Success = false;
  739. res.Message = "请传入参数";
  740. }
  741. }
  742. catch (Exception ex)
  743. {
  744. log.Error("参数检验失败:" + ex.ToString());
  745. res.Success = false;
  746. res.Message = ex.Message;
  747. }
  748. finally
  749. {
  750. str = JsonConvert.SerializeObject(res);
  751. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  752. }
  753. log.Debug("创建到货单返回值:" + str);
  754. return result;
  755. }
  756. /// <summary>
  757. /// 审核到货单
  758. /// </summary>
  759. /// <param name="JsonData"></param>
  760. /// <returns></returns>
  761. [Route("api/CreatePOArrive/Approve")]
  762. [HttpPost]
  763. public HttpResponseMessage Approve([FromBody] object JsonData)
  764. {
  765. log.Info("接口:api/CreatePOArrive/Approve");
  766. log.Info("审核到货单传入值:" + JsonData);
  767. HttpResponseMessage result = new HttpResponseMessage();
  768. Result res = new Result();
  769. string str = string.Empty;
  770. try
  771. {
  772. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  773. {
  774. try
  775. {
  776. List<ICSPOArrive> infos = new List<ICSPOArrive>();
  777. try
  778. {
  779. infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(JsonData.ToString());
  780. }
  781. catch (Exception ex)
  782. {
  783. log.Error("转换失败:" + ex.ToString());
  784. res.Success = false;
  785. res.Message = "JSON格式不正确!";
  786. }
  787. CreatePOArrive action = new CreatePOArrive();
  788. string resultStr = action.Approve(infos);
  789. if (string.IsNullOrWhiteSpace(resultStr))
  790. {
  791. res.Success = true;
  792. res.Message = "接口调用成功!";
  793. //res.Data = resultStr;
  794. }
  795. else
  796. {
  797. res.Success = false;
  798. res.Message = "接口调用失败";
  799. }
  800. }
  801. catch (Exception ex)
  802. {
  803. log.Error("调用后台失败:" + ex.ToString());
  804. res.Success = false;
  805. res.Message = ex.Message;
  806. }
  807. }
  808. else
  809. {
  810. res.Success = false;
  811. res.Message = "请传入参数";
  812. }
  813. }
  814. catch (Exception ex)
  815. {
  816. log.Error("参数检验失败:" + ex.ToString());
  817. res.Success = false;
  818. res.Message = ex.Message;
  819. }
  820. finally
  821. {
  822. str = JsonConvert.SerializeObject(res);
  823. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  824. }
  825. log.Debug("审核到货单返回值:" + str);
  826. return result;
  827. }
  828. /// <summary>
  829. /// 删除到货单
  830. /// </summary>
  831. /// <param name="JsonData"></param>
  832. /// <returns></returns>
  833. [Route("api/CreatePOArrive/Delete")]
  834. [HttpPost]
  835. public HttpResponseMessage Delete([FromBody] object JsonData)
  836. {
  837. log.Info("接口:api/CreatePOArrive/Delete");
  838. log.Info("删除到货单传入值:" + JsonData);
  839. HttpResponseMessage result = new HttpResponseMessage();
  840. Result res = new Result();
  841. string str = string.Empty;
  842. try
  843. {
  844. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  845. {
  846. try
  847. {
  848. List<ICSPOArrive> infos = new List<ICSPOArrive>();
  849. try
  850. {
  851. infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(JsonData.ToString());
  852. }
  853. catch (Exception ex)
  854. {
  855. log.Error("转换失败:" + ex.ToString());
  856. res.Success = false;
  857. res.Message = "JSON格式不正确!";
  858. }
  859. CreatePOArrive action = new CreatePOArrive();
  860. string resultStr = action.Delete(infos);
  861. if (string.IsNullOrWhiteSpace(resultStr))
  862. {
  863. res.Success = true;
  864. res.Message = "接口调用成功!";
  865. //res.Data = resultStr;
  866. }
  867. else
  868. {
  869. res.Success = false;
  870. res.Message = "接口调用失败";
  871. }
  872. }
  873. catch (Exception ex)
  874. {
  875. log.Error("调用后台失败:" + ex.ToString());
  876. res.Success = false;
  877. res.Message = ex.Message;
  878. }
  879. }
  880. else
  881. {
  882. res.Success = false;
  883. res.Message = "请传入参数";
  884. }
  885. }
  886. catch (Exception ex)
  887. {
  888. log.Error("参数检验失败:" + ex.ToString());
  889. res.Success = false;
  890. res.Message = ex.Message;
  891. }
  892. finally
  893. {
  894. str = JsonConvert.SerializeObject(res);
  895. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  896. }
  897. log.Debug("删除到货单返回值:" + str);
  898. return result;
  899. }
  900. #endregion
  901. #region 拒收单
  902. /// <summary>
  903. /// 获取拒收单
  904. /// </summary>
  905. /// <param name="JsonData"></param>
  906. /// <returns></returns>
  907. [Route("api/CreatePuArrivalVouch/Get")]
  908. [HttpPost]
  909. public HttpResponseMessage GetPuArrivalVouch([FromBody] object JsonData)
  910. {
  911. log.Info("接口:api/CreatePuArrivalVouch/Get");
  912. log.Info("获取拒收单传入值:" + JsonData);
  913. HttpResponseMessage result = new HttpResponseMessage();
  914. Result res = new Result();
  915. string str = string.Empty;
  916. try
  917. {
  918. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  919. {
  920. try
  921. {
  922. List<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>();
  923. try
  924. {
  925. infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(JsonData.ToString());
  926. }
  927. catch (Exception ex)
  928. {
  929. log.Error("转换失败:" + ex.ToString());
  930. res.Success = false;
  931. res.Message = "JSON格式不正确!";
  932. }
  933. CreatePuArrivalVouch action = new CreatePuArrivalVouch();
  934. string resultStr = action.Get(infos);
  935. if (resultStr.Length > 0)
  936. {
  937. res.Success = true;
  938. res.Message = "接口调用成功!";
  939. res.Data = resultStr;
  940. }
  941. else
  942. {
  943. res.Success = false;
  944. res.Message = "接口调用失败";
  945. }
  946. }
  947. catch (Exception ex)
  948. {
  949. log.Error("调用后台失败:" + ex.ToString());
  950. res.Success = false;
  951. res.Message = ex.Message;
  952. }
  953. }
  954. else
  955. {
  956. res.Success = false;
  957. res.Message = "请传入参数";
  958. }
  959. }
  960. catch (Exception ex)
  961. {
  962. log.Error("参数检验失败:" + ex.ToString());
  963. res.Success = false;
  964. res.Message = ex.Message;
  965. }
  966. finally
  967. {
  968. str = JsonConvert.SerializeObject(res);
  969. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  970. }
  971. log.Debug("获取拒收单返回值:" + str);
  972. return result;
  973. }
  974. /// <summary>
  975. /// 创建拒收单
  976. /// </summary>
  977. /// <param name="JsonData"></param>
  978. /// <returns></returns>
  979. [Route("api/CreatePuArrivalVouch/Create")]
  980. [HttpPost]
  981. public HttpResponseMessage CreatePuArrivalVouch([FromBody] object JsonData)
  982. {
  983. log.Info("接口:api/CreatePuArrivalVouch/Create");
  984. log.Info("创建拒收单传入值:" + JsonData);
  985. HttpResponseMessage result = new HttpResponseMessage();
  986. Result res = new Result();
  987. string str = string.Empty;
  988. try
  989. {
  990. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  991. {
  992. try
  993. {
  994. List<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>();
  995. try
  996. {
  997. infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(JsonData.ToString());
  998. }
  999. catch (Exception ex)
  1000. {
  1001. log.Error("转换失败:" + ex.ToString());
  1002. res.Success = false;
  1003. res.Message = "JSON格式不正确!";
  1004. throw new Exception(res.Message);
  1005. }
  1006. CreatePuArrivalVouch action = new CreatePuArrivalVouch();
  1007. string resultStr = action.CreatePUArrive(infos);
  1008. if (!string.IsNullOrWhiteSpace(resultStr))
  1009. {
  1010. res.Success = true;
  1011. res.Data = resultStr;
  1012. res.Message = "接口调用成功!";
  1013. }
  1014. else
  1015. {
  1016. res.Success = false;
  1017. res.Data = resultStr;
  1018. }
  1019. }
  1020. catch (Exception ex)
  1021. {
  1022. log.Error("调用后台失败:" + ex.ToString());
  1023. res.Success = false;
  1024. res.Message = ex.Message;
  1025. }
  1026. }
  1027. else
  1028. {
  1029. res.Success = false;
  1030. res.Message = "请传入参数";
  1031. }
  1032. }
  1033. catch (Exception ex)
  1034. {
  1035. log.Error("参数检验失败:" + ex.ToString());
  1036. res.Success = false;
  1037. res.Message = ex.Message;
  1038. }
  1039. finally
  1040. {
  1041. str = JsonConvert.SerializeObject(res);
  1042. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1043. }
  1044. log.Debug("创建拒收单返回值:" + str);
  1045. return result;
  1046. }
  1047. /// <summary>
  1048. /// 创建委外拒收单
  1049. /// </summary>
  1050. /// <param name="JsonData"></param>
  1051. /// <returns></returns>
  1052. [Route("api/CreateWPuArrivalVouch/CreateNew")]
  1053. [HttpPost]
  1054. public HttpResponseMessage CreatePuArrivalVouchNEW([FromBody] object JsonData)
  1055. {
  1056. log.Info("接口:api/CreateWPuArrivalVouch/CreateNew");
  1057. log.Info("创建委外拒收单传入值:" + JsonData);
  1058. HttpResponseMessage result = new HttpResponseMessage();
  1059. Result res = new Result();
  1060. string str = string.Empty;
  1061. try
  1062. {
  1063. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1064. {
  1065. try
  1066. {
  1067. List<ICSOPUArrivalVouch> infos = new List<ICSOPUArrivalVouch>();
  1068. try
  1069. {
  1070. infos = JsonConvert.DeserializeObject<List<ICSOPUArrivalVouch>>(JsonData.ToString());
  1071. }
  1072. catch (Exception ex)
  1073. {
  1074. log.Error("转换失败:" + ex.ToString());
  1075. res.Success = false;
  1076. res.Message = "JSON格式不正确!";
  1077. throw new Exception(res.Message);
  1078. }
  1079. CreatePuArrivalVouch action = new CreatePuArrivalVouch();
  1080. string resultStr = action.CreateWPUArrive(infos);
  1081. if (!string.IsNullOrWhiteSpace(resultStr))
  1082. {
  1083. res.Success = true;
  1084. res.Data = resultStr;
  1085. res.Message = "接口调用成功!";
  1086. }
  1087. else
  1088. {
  1089. res.Success = false;
  1090. res.Data = resultStr;
  1091. }
  1092. }
  1093. catch (Exception ex)
  1094. {
  1095. log.Error("调用后台失败:" + ex.ToString());
  1096. res.Success = false;
  1097. res.Message = ex.Message;
  1098. }
  1099. }
  1100. else
  1101. {
  1102. res.Success = false;
  1103. res.Message = "请传入参数";
  1104. }
  1105. }
  1106. catch (Exception ex)
  1107. {
  1108. log.Error("参数检验失败:" + ex.ToString());
  1109. res.Success = false;
  1110. res.Message = ex.Message;
  1111. }
  1112. finally
  1113. {
  1114. str = JsonConvert.SerializeObject(res);
  1115. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1116. }
  1117. log.Debug("创建拒收单返回值:" + str);
  1118. return result;
  1119. }
  1120. /// <summary>
  1121. /// 审核拒收单
  1122. /// </summary>
  1123. /// <param name="JsonData"></param>
  1124. /// <returns></returns>
  1125. [Route("api/CreatePuArrivalVouch/Approve")]
  1126. [HttpPost]
  1127. public HttpResponseMessage ApprovePuArrivalVouch([FromBody] object JsonData)
  1128. {
  1129. log.Info("接口:api/CreatePuArrivalVouch/Approve");
  1130. log.Info("审核拒收单传入值:" + JsonData);
  1131. HttpResponseMessage result = new HttpResponseMessage();
  1132. Result res = new Result();
  1133. string str = string.Empty;
  1134. try
  1135. {
  1136. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1137. {
  1138. try
  1139. {
  1140. List<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>();
  1141. try
  1142. {
  1143. infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(JsonData.ToString());
  1144. }
  1145. catch (Exception ex)
  1146. {
  1147. log.Error("转换失败:" + ex.ToString());
  1148. res.Success = false;
  1149. res.Message = "JSON格式不正确!";
  1150. }
  1151. CreatePuArrivalVouch action = new CreatePuArrivalVouch();
  1152. string resultStr = action.Approve(infos);
  1153. if (string.IsNullOrWhiteSpace(resultStr))
  1154. {
  1155. res.Success = true;
  1156. res.Message = "接口调用成功!";
  1157. res.Data = resultStr;
  1158. }
  1159. else
  1160. {
  1161. res.Success = false;
  1162. res.Message = "接口调用失败";
  1163. }
  1164. }
  1165. catch (Exception ex)
  1166. {
  1167. log.Error("调用后台失败:" + ex.ToString());
  1168. res.Success = false;
  1169. res.Message = ex.Message;
  1170. }
  1171. }
  1172. else
  1173. {
  1174. res.Success = false;
  1175. res.Message = "请传入参数";
  1176. }
  1177. }
  1178. catch (Exception ex)
  1179. {
  1180. log.Error("参数检验失败:" + ex.ToString());
  1181. res.Success = false;
  1182. res.Message = ex.Message;
  1183. }
  1184. finally
  1185. {
  1186. str = JsonConvert.SerializeObject(res);
  1187. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1188. }
  1189. log.Debug("审核拒收单返回值:" + str);
  1190. return result;
  1191. }
  1192. /// <summary>
  1193. /// 删除拒收单
  1194. /// </summary>
  1195. /// <param name="JsonData"></param>
  1196. /// <returns></returns>
  1197. [Route("api/CreatePuArrivalVouch/Delete")]
  1198. [HttpPost]
  1199. public HttpResponseMessage DeletePuArrivalVouch([FromBody] object JsonData)
  1200. {
  1201. log.Info("接口:api/CreatePuArrivalVouch/Delete");
  1202. log.Info("删除拒收单传入值:" + JsonData);
  1203. HttpResponseMessage result = new HttpResponseMessage();
  1204. Result res = new Result();
  1205. string str = string.Empty;
  1206. try
  1207. {
  1208. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1209. {
  1210. try
  1211. {
  1212. List<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>();
  1213. try
  1214. {
  1215. infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(JsonData.ToString());
  1216. }
  1217. catch (Exception ex)
  1218. {
  1219. log.Error("转换失败:" + ex.ToString());
  1220. res.Success = false;
  1221. res.Message = "JSON格式不正确!";
  1222. }
  1223. CreatePuArrivalVouch action = new CreatePuArrivalVouch();
  1224. string resultStr = action.Delete(infos);
  1225. if (resultStr.Length > 0)
  1226. {
  1227. res.Success = true;
  1228. res.Message = "接口调用成功!";
  1229. res.Data = resultStr;
  1230. }
  1231. else
  1232. {
  1233. res.Success = false;
  1234. res.Message = "接口调用失败";
  1235. }
  1236. }
  1237. catch (Exception ex)
  1238. {
  1239. log.Error("调用后台失败:" + ex.ToString());
  1240. res.Success = false;
  1241. res.Message = ex.Message;
  1242. }
  1243. }
  1244. else
  1245. {
  1246. res.Success = false;
  1247. res.Message = "请传入参数";
  1248. }
  1249. }
  1250. catch (Exception ex)
  1251. {
  1252. log.Error("参数检验失败:" + ex.ToString());
  1253. res.Success = false;
  1254. res.Message = ex.Message;
  1255. }
  1256. finally
  1257. {
  1258. str = JsonConvert.SerializeObject(res);
  1259. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1260. }
  1261. log.Debug("删除拒收单返回值:" + str);
  1262. return result;
  1263. }
  1264. #endregion
  1265. #region 采购入库单
  1266. /// <summary>
  1267. /// 获取采购入库单
  1268. /// </summary>
  1269. /// <param name="JsonData"></param>
  1270. /// <returns></returns>
  1271. [Route("api/PurchaseReceiveDoc/Get")]
  1272. [HttpPost]
  1273. public HttpResponseMessage GetRdRecord01([FromBody] object JsonData)
  1274. {
  1275. log.Info("接口:api/PurchaseReceiveDoc/Get");
  1276. log.Info("获取采购入库单传入值:" + JsonData);
  1277. HttpResponseMessage result = new HttpResponseMessage();
  1278. Result res = new Result();
  1279. string str = string.Empty;
  1280. try
  1281. {
  1282. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1283. {
  1284. try
  1285. {
  1286. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  1287. try
  1288. {
  1289. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  1290. }
  1291. catch (Exception ex)
  1292. {
  1293. log.Error("转换失败:" + ex.ToString());
  1294. res.Success = false;
  1295. res.Message = "JSON格式不正确!";
  1296. }
  1297. PurchaseReceiveDoc action = new PurchaseReceiveDoc();
  1298. string resultStr = action.Get(infos);
  1299. if (!string.IsNullOrWhiteSpace(resultStr))
  1300. {
  1301. res.Success = true;
  1302. res.Message = "接口调用成功!";
  1303. res.Data = resultStr;
  1304. }
  1305. else
  1306. {
  1307. res.Success = false;
  1308. res.Message = "接口调用失败";
  1309. }
  1310. }
  1311. catch (Exception ex)
  1312. {
  1313. log.Error("调用后台失败:" + ex.ToString());
  1314. res.Success = false;
  1315. res.Message = ex.Message;
  1316. }
  1317. }
  1318. else
  1319. {
  1320. res.Success = false;
  1321. res.Message = "请传入参数";
  1322. }
  1323. }
  1324. catch (Exception ex)
  1325. {
  1326. log.Error("参数检验失败:" + ex.ToString());
  1327. res.Success = false;
  1328. res.Message = ex.Message;
  1329. }
  1330. finally
  1331. {
  1332. str = JsonConvert.SerializeObject(res);
  1333. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1334. }
  1335. log.Debug("获取采购入库单返回值:" + str);
  1336. return result;
  1337. }
  1338. ///// <summary>
  1339. ///// 创建采购入库单(源头单据采购订单)
  1340. ///// </summary>
  1341. ///// <param name="JsonData"></param>
  1342. ///// <returns></returns>
  1343. //[Route("api/PurchaseReceiveDoc/Create")]
  1344. //[HttpPost]
  1345. //public HttpResponseMessage CreateRdRecord01([FromBody] object JsonData)
  1346. //{
  1347. // log.Info("接口:api/PurchaseReceiveDoc/Create");
  1348. // log.Info("创建采购入库单(源头单据采购订单)传入值:" + JsonData);
  1349. // HttpResponseMessage result = new HttpResponseMessage();
  1350. // Result res = new Result();
  1351. // string str = string.Empty;
  1352. // try
  1353. // {
  1354. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1355. // {
  1356. // try
  1357. // {
  1358. // List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  1359. // try
  1360. // {
  1361. // infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  1362. // }
  1363. // catch (Exception ex)
  1364. // {
  1365. // log.Error("转换失败:" + ex.ToString());
  1366. // res.Success = false;
  1367. // res.Message = "JSON格式不正确!";
  1368. // throw new Exception(res.Message);
  1369. // }
  1370. // PurchaseReceiveDoc action = new PurchaseReceiveDoc();
  1371. // string resultStr = action.CreateRdRecord01sByPO(infos);
  1372. // if (!string.IsNullOrWhiteSpace(resultStr))
  1373. // {
  1374. // res.Success = true;
  1375. // res.Message = "接口调用成功!";
  1376. // res.Data = resultStr;
  1377. // }
  1378. // else
  1379. // {
  1380. // res.Success = false;
  1381. // res.Data = resultStr;
  1382. // }
  1383. // }
  1384. // catch (Exception ex)
  1385. // {
  1386. // log.Error("调用后台失败:" + ex.ToString());
  1387. // res.Success = false;
  1388. // res.Message = ex.Message;
  1389. // }
  1390. // }
  1391. // else
  1392. // {
  1393. // res.Success = false;
  1394. // res.Message = "请传入参数";
  1395. // }
  1396. // }
  1397. // catch (Exception ex)
  1398. // {
  1399. // log.Error("参数检验失败:" + ex.ToString());
  1400. // res.Success = false;
  1401. // res.Message = ex.Message;
  1402. // }
  1403. // finally
  1404. // {
  1405. // str = JsonConvert.SerializeObject(res);
  1406. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1407. // }
  1408. // log.Debug("创建采购入库单(源头单据采购订单)返回值:" + str);
  1409. // return result;
  1410. //}
  1411. /// <summary>
  1412. /// 创建采购入库单(源头单据到货单)
  1413. /// </summary>
  1414. /// <param name="JsonData"></param>
  1415. /// <returns></returns>
  1416. //[Route("api/PurchaseReceiveDocPOArrive/Create")]
  1417. //[HttpPost]
  1418. //public HttpResponseMessage CreateRdRecord01ByPOArrive([FromBody] object JsonData)
  1419. //{
  1420. // log.Info("接口:api/PurchaseReceiveDocPOArrive/Create");
  1421. // log.Info("创建采购入库单(源头单据到货单)传入值:" + JsonData);
  1422. // HttpResponseMessage result = new HttpResponseMessage();
  1423. // Result res = new Result();
  1424. // string str = string.Empty;
  1425. // try
  1426. // {
  1427. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1428. // {
  1429. // try
  1430. // {
  1431. // List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  1432. // try
  1433. // {
  1434. // infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  1435. // }
  1436. // catch (Exception ex)
  1437. // {
  1438. // log.Error("转换失败:" + ex.ToString());
  1439. // res.Success = false;
  1440. // res.Message = "JSON格式不正确!";
  1441. // throw new Exception(res.Message);
  1442. // }
  1443. // PurchaseReceiveDoc action = new PurchaseReceiveDoc();
  1444. // string resultStr = action.CreateRdRecord01sByPOArrive(infos);
  1445. // if (!string.IsNullOrWhiteSpace(resultStr))
  1446. // {
  1447. // res.Success = true;
  1448. // res.Message = "接口调用成功!";
  1449. // res.Data = resultStr;
  1450. // }
  1451. // else
  1452. // {
  1453. // res.Success = false;
  1454. // res.Data = resultStr;
  1455. // }
  1456. // }
  1457. // catch (Exception ex)
  1458. // {
  1459. // log.Error("调用后台失败:" + ex.ToString());
  1460. // res.Success = false;
  1461. // res.Message = ex.Message;
  1462. // }
  1463. // }
  1464. // else
  1465. // {
  1466. // res.Success = false;
  1467. // res.Message = "请传入参数";
  1468. // }
  1469. // }
  1470. // catch (Exception ex)
  1471. // {
  1472. // log.Error("参数检验失败:" + ex.ToString());
  1473. // res.Success = false;
  1474. // res.Message = ex.Message;
  1475. // }
  1476. // finally
  1477. // {
  1478. // str = JsonConvert.SerializeObject(res);
  1479. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1480. // }
  1481. // log.Debug("创建采购入库单(源头单据到货单)返回值:" + str);
  1482. // return result;
  1483. //}
  1484. /// <summary>
  1485. /// 审核采购入库单
  1486. /// </summary>
  1487. /// <param name="JsonData"></param>
  1488. /// <returns></returns>
  1489. [Route("api/PurchaseReceiveDoc/Approve")]
  1490. [HttpPost]
  1491. public HttpResponseMessage ApproveRdRecord01([FromBody] object JsonData)
  1492. {
  1493. log.Info("接口:api/PurchaseReceiveDoc/Approve");
  1494. log.Info("审核采购入库单传入值:" + JsonData);
  1495. HttpResponseMessage result = new HttpResponseMessage();
  1496. Result res = new Result();
  1497. string str = string.Empty;
  1498. try
  1499. {
  1500. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1501. {
  1502. try
  1503. {
  1504. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  1505. try
  1506. {
  1507. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  1508. }
  1509. catch (Exception ex)
  1510. {
  1511. log.Error("转换失败:" + ex.ToString());
  1512. res.Success = false;
  1513. res.Message = "JSON格式不正确!";
  1514. }
  1515. PurchaseReceiveDoc action = new PurchaseReceiveDoc();
  1516. string resultStr = action.Approve(infos);
  1517. if (resultStr.Length > 0)
  1518. {
  1519. res.Success = true;
  1520. res.Message = "接口调用成功!";
  1521. res.Data = resultStr;
  1522. }
  1523. else
  1524. {
  1525. res.Success = false;
  1526. res.Message = "接口调用失败";
  1527. }
  1528. }
  1529. catch (Exception ex)
  1530. {
  1531. log.Error("调用后台失败:" + ex.ToString());
  1532. res.Success = false;
  1533. res.Message = ex.Message;
  1534. }
  1535. }
  1536. else
  1537. {
  1538. res.Success = false;
  1539. res.Message = "请传入参数";
  1540. }
  1541. }
  1542. catch (Exception ex)
  1543. {
  1544. log.Error("参数检验失败:" + ex.ToString());
  1545. res.Success = false;
  1546. res.Message = ex.Message;
  1547. }
  1548. finally
  1549. {
  1550. str = JsonConvert.SerializeObject(res);
  1551. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1552. }
  1553. log.Debug("审核采购入库单返回值:" + str);
  1554. return result;
  1555. }
  1556. /// <summary>
  1557. /// 删除采购入库单
  1558. /// </summary>
  1559. /// <param name="JsonData"></param>
  1560. /// <returns></returns>
  1561. [Route("api/PurchaseReceiveDoc/Delete")]
  1562. [HttpPost]
  1563. public HttpResponseMessage DeleteRdRecord01([FromBody] object JsonData)
  1564. {
  1565. log.Info("接口:api/PurchaseReceiveDoc/Delete");
  1566. log.Info("删除采购入库单传入值:" + JsonData);
  1567. HttpResponseMessage result = new HttpResponseMessage();
  1568. Result res = new Result();
  1569. string str = string.Empty;
  1570. try
  1571. {
  1572. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1573. {
  1574. try
  1575. {
  1576. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  1577. try
  1578. {
  1579. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  1580. }
  1581. catch (Exception ex)
  1582. {
  1583. log.Error("转换失败:" + ex.ToString());
  1584. res.Success = false;
  1585. res.Message = "JSON格式不正确!";
  1586. }
  1587. PurchaseReceiveDoc action = new PurchaseReceiveDoc();
  1588. string resultStr = action.Delete(infos);
  1589. if (resultStr.Length > 0)
  1590. {
  1591. res.Success = true;
  1592. res.Message = "接口调用成功!";
  1593. res.Data = resultStr;
  1594. }
  1595. else
  1596. {
  1597. res.Success = false;
  1598. res.Message = "接口调用失败";
  1599. }
  1600. }
  1601. catch (Exception ex)
  1602. {
  1603. log.Error("调用后台失败:" + ex.ToString());
  1604. res.Success = false;
  1605. res.Message = ex.Message;
  1606. }
  1607. }
  1608. else
  1609. {
  1610. res.Success = false;
  1611. res.Message = "请传入参数";
  1612. }
  1613. }
  1614. catch (Exception ex)
  1615. {
  1616. log.Error("参数检验失败:" + ex.ToString());
  1617. res.Success = false;
  1618. res.Message = ex.Message;
  1619. }
  1620. finally
  1621. {
  1622. str = JsonConvert.SerializeObject(res);
  1623. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1624. }
  1625. log.Debug("删除采购入库单返回值:" + str);
  1626. return result;
  1627. }
  1628. #endregion
  1629. #region 采购退货单
  1630. /// <summary>
  1631. /// 创建物料检验单
  1632. /// </summary>
  1633. /// <param name="JsonData"></param>
  1634. /// <returns></returns>
  1635. [Route("api/PurchaseReturnBack/Get")]
  1636. [HttpPost]
  1637. public HttpResponseMessage GETPurchaseReturnBack([FromBody] object JsonData)
  1638. {
  1639. log.Info("接口:api/PurchaseReturnBack/Get");
  1640. log.Info("创建物料检验单传入值:" + JsonData);
  1641. HttpResponseMessage result = new HttpResponseMessage();
  1642. Result res = new Result();
  1643. string str = string.Empty;
  1644. try
  1645. {
  1646. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1647. {
  1648. try
  1649. {
  1650. List<ICSPurchaseReturnBack> infos = new List<ICSPurchaseReturnBack>();
  1651. try
  1652. {
  1653. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReturnBack>>(JsonData.ToString());
  1654. }
  1655. catch (Exception ex)
  1656. {
  1657. log.Error("转换失败:" + ex.ToString());
  1658. res.Success = false;
  1659. res.Message = "JSON格式不正确!";
  1660. }
  1661. PurchaseReturnBack action = new PurchaseReturnBack();
  1662. string resultStr = action.Get(infos);
  1663. if (string.IsNullOrWhiteSpace(resultStr))
  1664. {
  1665. res.Success = true;
  1666. res.Message = "接口调用成功!";
  1667. res.Data = resultStr;
  1668. }
  1669. else
  1670. {
  1671. res.Success = false;
  1672. res.Message = resultStr;
  1673. }
  1674. }
  1675. catch (Exception ex)
  1676. {
  1677. log.Error("调用后台失败:" + ex.ToString());
  1678. res.Success = false;
  1679. res.Message = ex.Message;
  1680. }
  1681. }
  1682. else
  1683. {
  1684. res.Success = false;
  1685. res.Message = "请传入参数";
  1686. }
  1687. }
  1688. catch (Exception ex)
  1689. {
  1690. log.Error("参数检验失败:" + ex.ToString());
  1691. res.Success = false;
  1692. res.Message = ex.Message;
  1693. }
  1694. finally
  1695. {
  1696. str = JsonConvert.SerializeObject(res);
  1697. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1698. }
  1699. log.Debug("创建物料检验单返回值:" + str);
  1700. return result;
  1701. }
  1702. #endregion
  1703. #region 采购红字入库单
  1704. /// <summary>
  1705. /// 获取采购红字入库单
  1706. /// </summary>
  1707. /// <param name="JsonData"></param>
  1708. /// <returns></returns>
  1709. [Route("api/PurchaseReceiveDoctNegative/Get")]
  1710. [HttpPost]
  1711. public HttpResponseMessage GetPurchaseReceiveDoctNegative([FromBody] object JsonData)
  1712. {
  1713. log.Info("接口:api/PurchaseReceiveDoctNegative/Get");
  1714. log.Info("获取采购红字入库单传入值:" + JsonData);
  1715. HttpResponseMessage result = new HttpResponseMessage();
  1716. Result res = new Result();
  1717. string str = string.Empty;
  1718. try
  1719. {
  1720. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1721. {
  1722. try
  1723. {
  1724. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  1725. try
  1726. {
  1727. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  1728. }
  1729. catch (Exception ex)
  1730. {
  1731. log.Error("转换失败:" + ex.ToString());
  1732. res.Success = false;
  1733. res.Message = "JSON格式不正确!";
  1734. }
  1735. PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
  1736. string resultStr = action.Get(infos);
  1737. if (resultStr.Length > 0)
  1738. {
  1739. res.Success = true;
  1740. res.Message = "接口调用成功!";
  1741. res.Data = resultStr;
  1742. }
  1743. else
  1744. {
  1745. res.Success = false;
  1746. res.Message = "接口调用失败";
  1747. }
  1748. }
  1749. catch (Exception ex)
  1750. {
  1751. log.Error("调用后台失败:" + ex.ToString());
  1752. res.Success = false;
  1753. res.Message = ex.Message;
  1754. }
  1755. }
  1756. else
  1757. {
  1758. res.Success = false;
  1759. res.Message = "请传入参数";
  1760. }
  1761. }
  1762. catch (Exception ex)
  1763. {
  1764. log.Error("参数检验失败:" + ex.ToString());
  1765. res.Success = false;
  1766. res.Message = ex.Message;
  1767. }
  1768. finally
  1769. {
  1770. str = JsonConvert.SerializeObject(res);
  1771. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1772. }
  1773. log.Debug("获取采购红字入库单返回值:" + str);
  1774. return result;
  1775. }
  1776. ///// <summary>
  1777. ///// 创建采购红字入库单
  1778. ///// </summary>
  1779. ///// <param name="JsonData"></param>
  1780. ///// <returns></returns>
  1781. //[Route("api/PurchaseReceiveDoctNegative/Create")]
  1782. //[HttpPost]
  1783. //public HttpResponseMessage CreatePurchaseReceiveDoctNegative([FromBody] object JsonData)
  1784. //{
  1785. // log.Info("接口:api/PurchaseReceiveDoctNegative/Create");
  1786. // log.Info("创建采购红字入库单传入值:" + JsonData);
  1787. // HttpResponseMessage result = new HttpResponseMessage();
  1788. // Result res = new Result();
  1789. // string str = string.Empty;
  1790. // try
  1791. // {
  1792. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1793. // {
  1794. // try
  1795. // {
  1796. // List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  1797. // try
  1798. // {
  1799. // infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  1800. // }
  1801. // catch (Exception ex)
  1802. // {
  1803. // log.Error("转换失败:" + ex.ToString());
  1804. // res.Success = false;
  1805. // res.Message = "JSON格式不正确!";
  1806. // throw new Exception(res.Message);
  1807. // }
  1808. // PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
  1809. // string resultStr = action.CreatePurchaseReceiveDoctNegative(infos);
  1810. // if (!string.IsNullOrWhiteSpace(resultStr))
  1811. // {
  1812. // res.Success = true;
  1813. // res.Message = "接口调用成功!";
  1814. // res.Data = resultStr;
  1815. // }
  1816. // else
  1817. // {
  1818. // res.Success = false;
  1819. // res.Data = resultStr;
  1820. // }
  1821. // }
  1822. // catch (Exception ex)
  1823. // {
  1824. // log.Error("调用后台失败:" + ex.ToString());
  1825. // res.Success = false;
  1826. // res.Message = ex.Message;
  1827. // }
  1828. // }
  1829. // else
  1830. // {
  1831. // res.Success = false;
  1832. // res.Message = "请传入参数";
  1833. // }
  1834. // }
  1835. // catch (Exception ex)
  1836. // {
  1837. // log.Error("参数检验失败:" + ex.ToString());
  1838. // res.Success = false;
  1839. // res.Message = ex.Message;
  1840. // }
  1841. // finally
  1842. // {
  1843. // str = JsonConvert.SerializeObject(res);
  1844. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1845. // }
  1846. // log.Debug("创建采购红字入库单返回值:" + str);
  1847. // return result;
  1848. //}
  1849. /// <summary>
  1850. /// 审核采购红字入库单
  1851. /// </summary>
  1852. /// <param name="JsonData"></param>
  1853. /// <returns></returns>
  1854. [Route("api/PurchaseReceiveDoctNegative/Approve")]
  1855. [HttpPost]
  1856. public HttpResponseMessage ApprovePurchaseReceiveDoctNegative([FromBody] object JsonData)
  1857. {
  1858. log.Info("接口:api/PurchaseReceiveDoctNegative/Approve");
  1859. log.Info("审核采购红字入库单传入值:" + JsonData);
  1860. HttpResponseMessage result = new HttpResponseMessage();
  1861. Result res = new Result();
  1862. string str = string.Empty;
  1863. try
  1864. {
  1865. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1866. {
  1867. try
  1868. {
  1869. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  1870. try
  1871. {
  1872. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  1873. }
  1874. catch (Exception ex)
  1875. {
  1876. log.Error("转换失败:" + ex.ToString());
  1877. res.Success = false;
  1878. res.Message = "JSON格式不正确!";
  1879. }
  1880. PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
  1881. bool resultStr = action.Approve(infos);
  1882. if (resultStr == true)
  1883. {
  1884. res.Success = true;
  1885. res.Message = "接口调用成功!";
  1886. }
  1887. else
  1888. {
  1889. res.Success = false;
  1890. res.Message = "接口调用失败";
  1891. }
  1892. }
  1893. catch (Exception ex)
  1894. {
  1895. log.Error("调用后台失败:" + ex.ToString());
  1896. res.Success = false;
  1897. res.Message = ex.Message;
  1898. }
  1899. }
  1900. else
  1901. {
  1902. res.Success = false;
  1903. res.Message = "请传入参数";
  1904. }
  1905. }
  1906. catch (Exception ex)
  1907. {
  1908. log.Error("参数检验失败:" + ex.ToString());
  1909. res.Success = false;
  1910. res.Message = ex.Message;
  1911. }
  1912. finally
  1913. {
  1914. str = JsonConvert.SerializeObject(res);
  1915. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1916. }
  1917. log.Debug("审核采购红字入库单返回值:" + str);
  1918. return result;
  1919. }
  1920. /// <summary>
  1921. /// 删除采购红字入库单
  1922. /// </summary>
  1923. /// <param name="JsonData"></param>
  1924. /// <returns></returns>
  1925. [Route("api/PurchaseReceiveDoctNegative/Delete")]
  1926. [HttpPost]
  1927. public HttpResponseMessage DeletePurchaseReceiveDoctNegative([FromBody] object JsonData)
  1928. {
  1929. log.Info("接口:api/PurchaseReceiveDoctNegative/Delete");
  1930. log.Info("删除采购红字入库单传入值:" + JsonData);
  1931. HttpResponseMessage result = new HttpResponseMessage();
  1932. Result res = new Result();
  1933. string str = string.Empty;
  1934. try
  1935. {
  1936. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  1937. {
  1938. try
  1939. {
  1940. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  1941. try
  1942. {
  1943. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  1944. }
  1945. catch (Exception ex)
  1946. {
  1947. log.Error("转换失败:" + ex.ToString());
  1948. res.Success = false;
  1949. res.Message = "JSON格式不正确!";
  1950. }
  1951. PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
  1952. string resultStr = action.Delete(infos);
  1953. if (resultStr.Length > 0)
  1954. {
  1955. res.Success = true;
  1956. res.Message = "接口调用成功!";
  1957. res.Data = resultStr;
  1958. }
  1959. else
  1960. {
  1961. res.Success = false;
  1962. res.Message = "接口调用失败";
  1963. }
  1964. }
  1965. catch (Exception ex)
  1966. {
  1967. log.Error("调用后台失败:" + ex.ToString());
  1968. res.Success = false;
  1969. res.Message = ex.Message;
  1970. }
  1971. }
  1972. else
  1973. {
  1974. res.Success = false;
  1975. res.Message = "请传入参数";
  1976. }
  1977. }
  1978. catch (Exception ex)
  1979. {
  1980. log.Error("参数检验失败:" + ex.ToString());
  1981. res.Success = false;
  1982. res.Message = ex.Message;
  1983. }
  1984. finally
  1985. {
  1986. str = JsonConvert.SerializeObject(res);
  1987. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  1988. }
  1989. log.Debug("删除采购红字入库单返回值:" + str);
  1990. return result;
  1991. }
  1992. #endregion
  1993. #region 生产订单
  1994. /// <summary>
  1995. /// 获取采购订单
  1996. /// </summary>
  1997. /// <param name="JsonData"></param>
  1998. /// <returns></returns>
  1999. [Route("api/ManufactureOrder/Get")]
  2000. [HttpPost]
  2001. public HttpResponseMessage GetManufactureOrder([FromBody] object JsonData)
  2002. {
  2003. log.Info("接口:api/ManufactureOrder/Get");
  2004. log.Info("获取采购订单传入值:" + JsonData);
  2005. HttpResponseMessage result = new HttpResponseMessage();
  2006. Result res = new Result();
  2007. string str = string.Empty;
  2008. try
  2009. {
  2010. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2011. {
  2012. try
  2013. {
  2014. List<ICSManufactureOrder> infos = new List<ICSManufactureOrder>();
  2015. try
  2016. {
  2017. infos = JsonConvert.DeserializeObject<List<ICSManufactureOrder>>(JsonData.ToString());
  2018. }
  2019. catch (Exception ex)
  2020. {
  2021. log.Error("转换失败:" + ex.ToString());
  2022. res.Success = false;
  2023. res.Message = "JSON格式不正确!";
  2024. }
  2025. ManufactureOrder action = new ManufactureOrder();
  2026. string resultStr = action.GET(infos);
  2027. if (resultStr.Length > 0)
  2028. {
  2029. res.Success = true;
  2030. res.Message = "接口调用成功!";
  2031. res.Data = resultStr;
  2032. }
  2033. else
  2034. {
  2035. res.Success = false;
  2036. res.Message = "接口调用失败";
  2037. }
  2038. }
  2039. catch (Exception ex)
  2040. {
  2041. log.Error("调用后台失败:" + ex.ToString());
  2042. res.Success = false;
  2043. res.Message = ex.Message;
  2044. }
  2045. }
  2046. else
  2047. {
  2048. res.Success = false;
  2049. res.Message = "请传入参数";
  2050. }
  2051. }
  2052. catch (Exception ex)
  2053. {
  2054. log.Error("参数检验失败:" + ex.ToString());
  2055. res.Success = false;
  2056. res.Message = ex.Message;
  2057. }
  2058. finally
  2059. {
  2060. str = JsonConvert.SerializeObject(res);
  2061. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2062. }
  2063. log.Debug("获取采购订单返回值:" + str);
  2064. return result;
  2065. }
  2066. /// <summary>
  2067. /// 创建生产订单
  2068. /// </summary>
  2069. /// <param name="JsonData"></param>
  2070. /// <returns></returns>
  2071. [Route("api/ManufactureOrder/Create")]
  2072. [HttpPost]
  2073. public HttpResponseMessage CreateManufactureOrder([FromBody] object JsonData)
  2074. {
  2075. log.Info("接口:api/ManufactureOrder/Create");
  2076. log.Info("创建生产订单传入值:" + JsonData);
  2077. HttpResponseMessage result = new HttpResponseMessage();
  2078. Result res = new Result();
  2079. string str = string.Empty;
  2080. try
  2081. {
  2082. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2083. {
  2084. try
  2085. {
  2086. List<ICSManufactureOrder> infos = new List<ICSManufactureOrder>();
  2087. try
  2088. {
  2089. infos = JsonConvert.DeserializeObject<List<ICSManufactureOrder>>(JsonData.ToString());
  2090. }
  2091. catch (Exception ex)
  2092. {
  2093. log.Error("转换失败:" + ex.ToString());
  2094. res.Success = false;
  2095. res.Message = "JSON格式不正确!";
  2096. throw new Exception(res.Message);
  2097. }
  2098. ManufactureOrder action = new ManufactureOrder();
  2099. string resultStr = action.CreateManufactureOrder(infos);
  2100. if (!string.IsNullOrWhiteSpace(resultStr))
  2101. {
  2102. res.Success = true;
  2103. res.Message = "接口调用成功!";
  2104. res.Data = resultStr;
  2105. }
  2106. else
  2107. {
  2108. res.Success = false;
  2109. res.Data = resultStr;
  2110. }
  2111. }
  2112. catch (Exception ex)
  2113. {
  2114. log.Error("调用后台失败:" + ex.ToString());
  2115. res.Success = false;
  2116. res.Message = ex.Message;
  2117. }
  2118. }
  2119. else
  2120. {
  2121. res.Success = false;
  2122. res.Message = "请传入参数";
  2123. }
  2124. }
  2125. catch (Exception ex)
  2126. {
  2127. log.Error("参数检验失败:" + ex.ToString());
  2128. res.Success = false;
  2129. res.Message = ex.Message;
  2130. }
  2131. finally
  2132. {
  2133. str = JsonConvert.SerializeObject(res);
  2134. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2135. }
  2136. log.Debug("创建生产订单返回值:" + str);
  2137. return result;
  2138. }
  2139. /// <summary>
  2140. /// 删除生产订单
  2141. /// </summary>
  2142. /// <param name="JsonData"></param>
  2143. /// <returns></returns>
  2144. [Route("api/ManufactureOrder/Delete")]
  2145. [HttpPost]
  2146. public HttpResponseMessage DeleteManufactureOrder([FromBody] object JsonData)
  2147. {
  2148. log.Info("接口:api/ManufactureOrder/Delete");
  2149. log.Info("删除生产订单传入值:" + JsonData);
  2150. HttpResponseMessage result = new HttpResponseMessage();
  2151. Result res = new Result();
  2152. string str = string.Empty;
  2153. try
  2154. {
  2155. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2156. {
  2157. try
  2158. {
  2159. List<ICSManufactureOrder> infos = new List<ICSManufactureOrder>();
  2160. try
  2161. {
  2162. infos = JsonConvert.DeserializeObject<List<ICSManufactureOrder>>(JsonData.ToString());
  2163. }
  2164. catch (Exception ex)
  2165. {
  2166. log.Error("转换失败:" + ex.ToString());
  2167. res.Success = false;
  2168. res.Message = "JSON格式不正确!";
  2169. }
  2170. ManufactureOrder action = new ManufactureOrder();
  2171. string resultStr = action.Delete(infos);
  2172. if (string.IsNullOrWhiteSpace(resultStr))
  2173. {
  2174. res.Success = true;
  2175. res.Message = "接口调用成功!";
  2176. //res.Data = resultStr;
  2177. }
  2178. else
  2179. {
  2180. res.Success = false;
  2181. res.Message = "接口调用失败";
  2182. }
  2183. }
  2184. catch (Exception ex)
  2185. {
  2186. log.Error("调用后台失败:" + ex.ToString());
  2187. res.Success = false;
  2188. res.Message = ex.Message;
  2189. }
  2190. }
  2191. else
  2192. {
  2193. res.Success = false;
  2194. res.Message = "请传入参数";
  2195. }
  2196. }
  2197. catch (Exception ex)
  2198. {
  2199. log.Error("参数检验失败:" + ex.ToString());
  2200. res.Success = false;
  2201. res.Message = ex.Message;
  2202. }
  2203. finally
  2204. {
  2205. str = JsonConvert.SerializeObject(res);
  2206. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2207. }
  2208. log.Debug("删除生产订单返回值:" + str);
  2209. return result;
  2210. }
  2211. #endregion
  2212. #region 生产订单备料表
  2213. #endregion
  2214. #region 领料申请单
  2215. /// <summary>
  2216. /// 创建入库单
  2217. /// </summary>
  2218. /// <param name="JsonData"></param>
  2219. /// <returns></returns>
  2220. [Route("api/MOIssueApplyDoc/Get")]
  2221. [HttpPost]
  2222. public HttpResponseMessage GetMOIssueApplyDoc([FromBody] object JsonData)
  2223. {
  2224. log.Info("接口:api/MOIssueApplyDoc/Get");
  2225. log.Info("创建入库单传入值:" + JsonData);
  2226. HttpResponseMessage result = new HttpResponseMessage();
  2227. Result res = new Result();
  2228. string str = string.Empty;
  2229. try
  2230. {
  2231. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2232. {
  2233. try
  2234. {
  2235. List<ICSMaterialAppVouch> infos = new List<ICSMaterialAppVouch>();
  2236. try
  2237. {
  2238. infos = JsonConvert.DeserializeObject<List<ICSMaterialAppVouch>>(JsonData.ToString());
  2239. }
  2240. catch (Exception ex)
  2241. {
  2242. log.Error("转换失败:" + ex.ToString());
  2243. res.Success = false;
  2244. res.Message = "JSON格式不正确!";
  2245. }
  2246. MOIssueApplyDoc action = new MOIssueApplyDoc();
  2247. string resultStr = action.Get(infos);
  2248. if (!string.IsNullOrWhiteSpace(resultStr))
  2249. {
  2250. res.Success = true;
  2251. res.Message = "接口调用成功!";
  2252. res.Data = resultStr;
  2253. }
  2254. else
  2255. {
  2256. res.Success = false;
  2257. res.Message = resultStr;
  2258. }
  2259. }
  2260. catch (Exception ex)
  2261. {
  2262. log.Error("调用后台失败:" + ex.ToString());
  2263. res.Success = false;
  2264. res.Message = ex.Message;
  2265. }
  2266. }
  2267. else
  2268. {
  2269. res.Success = false;
  2270. res.Message = "请传入参数";
  2271. }
  2272. }
  2273. catch (Exception ex)
  2274. {
  2275. log.Error("参数检验失败:" + ex.ToString());
  2276. res.Success = false;
  2277. res.Message = ex.Message;
  2278. }
  2279. finally
  2280. {
  2281. str = JsonConvert.SerializeObject(res);
  2282. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2283. }
  2284. log.Debug("创建入库单返回值:" + str);
  2285. return result;
  2286. }
  2287. #endregion
  2288. #region 材料出库
  2289. /// <summary>
  2290. /// 获取材料出库
  2291. /// </summary>
  2292. /// <param name="JsonData"></param>
  2293. /// <returns></returns>
  2294. [Route("api/MOIssueDoc/Get")]
  2295. [HttpPost]
  2296. public HttpResponseMessage GetMOIssueDoc([FromBody] object JsonData)
  2297. {
  2298. log.Info("接口:api/MOIssueDoc/Get");
  2299. log.Info("获取材料出库传入值:" + JsonData);
  2300. HttpResponseMessage result = new HttpResponseMessage();
  2301. Result res = new Result();
  2302. string str = string.Empty;
  2303. try
  2304. {
  2305. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2306. {
  2307. try
  2308. {
  2309. List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
  2310. try
  2311. {
  2312. infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
  2313. }
  2314. catch (Exception ex)
  2315. {
  2316. log.Error("转换失败:" + ex.ToString());
  2317. res.Success = false;
  2318. res.Message = "JSON格式不正确!";
  2319. }
  2320. MOIssueDoc action = new MOIssueDoc();
  2321. string resultStr = action.Get(infos);
  2322. if (!string.IsNullOrWhiteSpace(resultStr))
  2323. {
  2324. res.Success = true;
  2325. res.Message = "接口调用成功!";
  2326. res.Data = resultStr;
  2327. }
  2328. else
  2329. {
  2330. res.Success = false;
  2331. res.Message = resultStr;
  2332. }
  2333. }
  2334. catch (Exception ex)
  2335. {
  2336. log.Error("调用后台失败:" + ex.ToString());
  2337. res.Success = false;
  2338. res.Message = ex.Message;
  2339. }
  2340. }
  2341. else
  2342. {
  2343. res.Success = false;
  2344. res.Message = "请传入参数";
  2345. }
  2346. }
  2347. catch (Exception ex)
  2348. {
  2349. log.Error("参数检验失败:" + ex.ToString());
  2350. res.Success = false;
  2351. res.Message = ex.Message;
  2352. }
  2353. finally
  2354. {
  2355. str = JsonConvert.SerializeObject(res);
  2356. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2357. }
  2358. log.Debug("获取材料出库返回值:" + str);
  2359. return result;
  2360. }
  2361. /// <summary>
  2362. /// 创建材料出库(生产订单)
  2363. /// </summary>
  2364. /// <param name="JsonData"></param>
  2365. /// <returns></returns>
  2366. [Route("api/MOIssueDoc/Create")]
  2367. [HttpPost]
  2368. public HttpResponseMessage CreateMOIssueDoc([FromBody] object JsonData)
  2369. {
  2370. log.Info("接口:api/MOIssueDoc/Create");
  2371. log.Info("创建材料出库(生产订单)传入值:" + JsonData);
  2372. HttpResponseMessage result = new HttpResponseMessage();
  2373. Result res = new Result();
  2374. string str = string.Empty;
  2375. try
  2376. {
  2377. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2378. {
  2379. try
  2380. {
  2381. List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
  2382. try
  2383. {
  2384. infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
  2385. }
  2386. catch (Exception ex)
  2387. {
  2388. log.Error("转换失败:" + ex.ToString());
  2389. res.Success = false;
  2390. res.Message = "JSON格式不正确!";
  2391. }
  2392. MOIssueDoc action = new MOIssueDoc();
  2393. string resultStr = action.CreateRd11(infos);
  2394. if (!string.IsNullOrWhiteSpace(resultStr))
  2395. {
  2396. res.Success = true;
  2397. res.Message = "接口调用成功!";
  2398. res.Data = resultStr;
  2399. }
  2400. else
  2401. {
  2402. res.Success = false;
  2403. res.Message = resultStr;
  2404. }
  2405. }
  2406. catch (Exception ex)
  2407. {
  2408. log.Error("调用后台失败:" + ex.ToString());
  2409. res.Success = false;
  2410. res.Message = ex.Message;
  2411. }
  2412. }
  2413. else
  2414. {
  2415. res.Success = false;
  2416. res.Message = "请传入参数";
  2417. }
  2418. }
  2419. catch (Exception ex)
  2420. {
  2421. log.Error("参数检验失败:" + ex.ToString());
  2422. res.Success = false;
  2423. res.Message = ex.Message;
  2424. }
  2425. finally
  2426. {
  2427. str = JsonConvert.SerializeObject(res);
  2428. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2429. }
  2430. log.Debug("创建材料出库(生产订单)返回值:" + str);
  2431. return result;
  2432. }
  2433. /// <summary>
  2434. /// 创建材料出库(领料申请)
  2435. /// </summary>
  2436. /// <param name="JsonData"></param>
  2437. /// <returns></returns>
  2438. [Route("api/MOIssueDocByPU/Create")]
  2439. [HttpPost]
  2440. public HttpResponseMessage CreateMOIssueDocBYPU([FromBody] object JsonData)
  2441. {
  2442. log.Info("接口:api/MOIssueDocByPU/Create");
  2443. log.Info("创建材料出库(领料申请)传入值:" + JsonData);
  2444. HttpResponseMessage result = new HttpResponseMessage();
  2445. Result res = new Result();
  2446. string str = string.Empty;
  2447. try
  2448. {
  2449. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2450. {
  2451. try
  2452. {
  2453. List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
  2454. try
  2455. {
  2456. infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
  2457. }
  2458. catch (Exception ex)
  2459. {
  2460. log.Error("转换失败:" + ex.ToString());
  2461. res.Success = false;
  2462. res.Message = "JSON格式不正确!";
  2463. }
  2464. MOIssueDoc action = new MOIssueDoc();
  2465. string resultStr = action.MaterialAppVouchs(infos);
  2466. if (!string.IsNullOrWhiteSpace(resultStr))
  2467. {
  2468. res.Success = true;
  2469. res.Message = "接口调用成功!";
  2470. res.Data = resultStr;
  2471. }
  2472. else
  2473. {
  2474. res.Success = false;
  2475. res.Message = resultStr;
  2476. }
  2477. }
  2478. catch (Exception ex)
  2479. {
  2480. log.Error("调用后台失败:" + ex.ToString());
  2481. res.Success = false;
  2482. res.Message = ex.Message;
  2483. }
  2484. }
  2485. else
  2486. {
  2487. res.Success = false;
  2488. res.Message = "请传入参数";
  2489. }
  2490. }
  2491. catch (Exception ex)
  2492. {
  2493. log.Error("参数检验失败:" + ex.ToString());
  2494. res.Success = false;
  2495. res.Message = ex.Message;
  2496. }
  2497. finally
  2498. {
  2499. str = JsonConvert.SerializeObject(res);
  2500. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2501. }
  2502. log.Debug("创建材料出库(领料申请)返回值:" + str);
  2503. return result;
  2504. }
  2505. /// <summary>
  2506. /// 审核材料出库(生产订单)
  2507. /// </summary>
  2508. /// <param name="JsonData"></param>
  2509. /// <returns></returns>
  2510. //[Route("api/MOIssueDoc/Approve")]
  2511. //[HttpPost]
  2512. //public HttpResponseMessage ApproveMOIssueDoc([FromBody] object JsonData)
  2513. //{
  2514. // log.Info("接口:api/MOIssueDoc/Approve");
  2515. // log.Info("审核材料出库(生产订单)传入值:" + JsonData);
  2516. // HttpResponseMessage result = new HttpResponseMessage();
  2517. // Result res = new Result();
  2518. // string str = string.Empty;
  2519. // try
  2520. // {
  2521. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2522. // {
  2523. // try
  2524. // {
  2525. // List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
  2526. // try
  2527. // {
  2528. // infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
  2529. // }
  2530. // catch (Exception ex)
  2531. // {
  2532. // log.Error("转换失败:" + ex.ToString());
  2533. // res.Success = false;
  2534. // res.Message = "JSON格式不正确!";
  2535. // }
  2536. // MOIssueDoc action = new MOIssueDoc();
  2537. // string resultStr = action.Approve(infos);
  2538. // if (string.IsNullOrWhiteSpace(resultStr))
  2539. // {
  2540. // res.Success = true;
  2541. // res.Message = "接口调用成功!";
  2542. // }
  2543. // else
  2544. // {
  2545. // res.Success = false;
  2546. // res.Message = resultStr;
  2547. // }
  2548. // }
  2549. // catch (Exception ex)
  2550. // {
  2551. // log.Error("调用后台失败:" + ex.ToString());
  2552. // res.Success = false;
  2553. // res.Message = ex.Message;
  2554. // }
  2555. // }
  2556. // else
  2557. // {
  2558. // res.Success = false;
  2559. // res.Message = "请传入参数";
  2560. // }
  2561. // }
  2562. // catch (Exception ex)
  2563. // {
  2564. // log.Error("参数检验失败:" + ex.ToString());
  2565. // res.Success = false;
  2566. // res.Message = ex.Message;
  2567. // }
  2568. // finally
  2569. // {
  2570. // str = JsonConvert.SerializeObject(res);
  2571. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2572. // }
  2573. // log.Debug("审核材料出库(生产订单)返回值:" + str);
  2574. // return result;
  2575. //}
  2576. /// <summary>
  2577. /// 删除材料出库(备料表)
  2578. /// </summary>
  2579. /// <param name="JsonData"></param>
  2580. /// <returns></returns>
  2581. [Route("api/MOIssueDoc/Delete")]
  2582. [HttpPost]
  2583. public HttpResponseMessage DeleteMOIssueDoc([FromBody] object JsonData)
  2584. {
  2585. log.Info("接口:api/MOIssueDoc/Delete");
  2586. log.Info("删除材料出库(备料表)传入值:" + JsonData);
  2587. HttpResponseMessage result = new HttpResponseMessage();
  2588. Result res = new Result();
  2589. string str = string.Empty;
  2590. try
  2591. {
  2592. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2593. {
  2594. try
  2595. {
  2596. List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
  2597. try
  2598. {
  2599. infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
  2600. }
  2601. catch (Exception ex)
  2602. {
  2603. log.Error("转换失败:" + ex.ToString());
  2604. res.Success = false;
  2605. res.Message = "JSON格式不正确!";
  2606. }
  2607. MOIssueDoc action = new MOIssueDoc();
  2608. string resultStr = action.Delete(infos);
  2609. if (string.IsNullOrWhiteSpace(resultStr))
  2610. {
  2611. res.Success = true;
  2612. res.Message = "接口调用成功!";
  2613. res.Data = resultStr;
  2614. }
  2615. else
  2616. {
  2617. res.Success = false;
  2618. res.Message = resultStr;
  2619. }
  2620. }
  2621. catch (Exception ex)
  2622. {
  2623. log.Error("调用后台失败:" + ex.ToString());
  2624. res.Success = false;
  2625. res.Message = ex.Message;
  2626. }
  2627. }
  2628. else
  2629. {
  2630. res.Success = false;
  2631. res.Message = "请传入参数";
  2632. }
  2633. }
  2634. catch (Exception ex)
  2635. {
  2636. log.Error("参数检验失败:" + ex.ToString());
  2637. res.Success = false;
  2638. res.Message = ex.Message;
  2639. }
  2640. finally
  2641. {
  2642. str = JsonConvert.SerializeObject(res);
  2643. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2644. }
  2645. log.Debug("删除材料出库(备料表)返回值:" + str);
  2646. return result;
  2647. }
  2648. #endregion
  2649. #region 生产退料单(红字材料出库)
  2650. /// <summary>
  2651. /// 获取生产退料单
  2652. /// </summary>
  2653. /// <param name="JsonData"></param>
  2654. /// <returns></returns>
  2655. [Route("api/MOIssueDocNegative/Get")]
  2656. [HttpPost]
  2657. public HttpResponseMessage GetMOIssueDocNegatives([FromBody] object JsonData)
  2658. {
  2659. log.Info("接口:api/MOIssueDocNegative/Get");
  2660. log.Info("获取生产退料单传入值:" + JsonData);
  2661. HttpResponseMessage result = new HttpResponseMessage();
  2662. Result res = new Result();
  2663. string str = string.Empty;
  2664. try
  2665. {
  2666. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2667. {
  2668. try
  2669. {
  2670. List<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>();
  2671. try
  2672. {
  2673. infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(JsonData.ToString());
  2674. }
  2675. catch (Exception ex)
  2676. {
  2677. log.Error("转换失败:" + ex.ToString());
  2678. res.Success = false;
  2679. res.Message = "JSON格式不正确!";
  2680. }
  2681. MOIssueDocNegatives action = new MOIssueDocNegatives();
  2682. string resultStr = action.Get(infos);
  2683. if (!string.IsNullOrWhiteSpace(resultStr))
  2684. {
  2685. res.Success = true;
  2686. res.Message = "接口调用成功!";
  2687. res.Data = resultStr;
  2688. }
  2689. else
  2690. {
  2691. res.Success = false;
  2692. res.Message = resultStr;
  2693. }
  2694. }
  2695. catch (Exception ex)
  2696. {
  2697. log.Error("调用后台失败:" + ex.ToString());
  2698. res.Success = false;
  2699. res.Message = ex.Message;
  2700. }
  2701. }
  2702. else
  2703. {
  2704. res.Success = false;
  2705. res.Message = "请传入参数";
  2706. }
  2707. }
  2708. catch (Exception ex)
  2709. {
  2710. log.Error("参数检验失败:" + ex.ToString());
  2711. res.Success = false;
  2712. res.Message = ex.Message;
  2713. }
  2714. finally
  2715. {
  2716. str = JsonConvert.SerializeObject(res);
  2717. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2718. }
  2719. log.Debug("获取生产退料单返回值:" + str);
  2720. return result;
  2721. }
  2722. ///// <summary>
  2723. ///// 创建生产退料单
  2724. ///// </summary>
  2725. ///// <param name="JsonData"></param>
  2726. ///// <returns></returns>
  2727. //[Route("api/MOIssueDocNegative/Create")]
  2728. //[HttpPost]
  2729. //public HttpResponseMessage CreateMOIssueDocNegatives([FromBody] object JsonData)
  2730. //{
  2731. // log.Info("接口:api/MOIssueDocNegative/Create");
  2732. // log.Info("创建生产退料单传入值:" + JsonData);
  2733. // HttpResponseMessage result = new HttpResponseMessage();
  2734. // Result res = new Result();
  2735. // string str = string.Empty;
  2736. // try
  2737. // {
  2738. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2739. // {
  2740. // try
  2741. // {
  2742. // List<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>();
  2743. // try
  2744. // {
  2745. // infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(JsonData.ToString());
  2746. // }
  2747. // catch (Exception ex)
  2748. // {
  2749. // log.Error("转换失败:" + ex.ToString());
  2750. // res.Success = false;
  2751. // res.Message = "JSON格式不正确!";
  2752. // }
  2753. // MOIssueDocNegatives action = new MOIssueDocNegatives();
  2754. // string resultStr = action.CreateRd11(infos);
  2755. // if (!string.IsNullOrWhiteSpace(resultStr))
  2756. // {
  2757. // res.Success = true;
  2758. // res.Message = "接口调用成功!";
  2759. // res.Data = resultStr;
  2760. // }
  2761. // else
  2762. // {
  2763. // res.Success = false;
  2764. // res.Message = resultStr;
  2765. // }
  2766. // }
  2767. // catch (Exception ex)
  2768. // {
  2769. // log.Error("调用后台失败:" + ex.ToString());
  2770. // res.Success = false;
  2771. // res.Message = ex.Message;
  2772. // }
  2773. // }
  2774. // else
  2775. // {
  2776. // res.Success = false;
  2777. // res.Message = "请传入参数";
  2778. // }
  2779. // }
  2780. // catch (Exception ex)
  2781. // {
  2782. // log.Error("参数检验失败:" + ex.ToString());
  2783. // res.Success = false;
  2784. // res.Message = ex.Message;
  2785. // }
  2786. // finally
  2787. // {
  2788. // str = JsonConvert.SerializeObject(res);
  2789. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2790. // }
  2791. // log.Debug("创建生产退料单返回值:" + str);
  2792. // return result;
  2793. //}
  2794. /// <summary>
  2795. /// 审核生产退料单
  2796. /// </summary>
  2797. /// <param name="JsonData"></param>
  2798. /// <returns></returns>
  2799. [Route("api/MOIssueDocNegative/Approve")]
  2800. [HttpPost]
  2801. public HttpResponseMessage ApproveMOIssueDocNegatives([FromBody] object JsonData)
  2802. {
  2803. log.Info("接口:api/MOIssueDocNegative/Approve");
  2804. log.Info("审核生产退料单传入值:" + JsonData);
  2805. HttpResponseMessage result = new HttpResponseMessage();
  2806. Result res = new Result();
  2807. string str = string.Empty;
  2808. try
  2809. {
  2810. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2811. {
  2812. try
  2813. {
  2814. List<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>();
  2815. try
  2816. {
  2817. infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(JsonData.ToString());
  2818. }
  2819. catch (Exception ex)
  2820. {
  2821. log.Error("转换失败:" + ex.ToString());
  2822. res.Success = false;
  2823. res.Message = "JSON格式不正确!";
  2824. }
  2825. MOIssueDocNegatives action = new MOIssueDocNegatives();
  2826. string resultStr = action.Approve(infos);
  2827. if (string.IsNullOrWhiteSpace(resultStr))
  2828. {
  2829. res.Success = true;
  2830. res.Message = "接口调用成功!";
  2831. }
  2832. else
  2833. {
  2834. res.Success = false;
  2835. res.Message = resultStr;
  2836. }
  2837. }
  2838. catch (Exception ex)
  2839. {
  2840. log.Error("调用后台失败:" + ex.ToString());
  2841. res.Success = false;
  2842. res.Message = ex.Message;
  2843. }
  2844. }
  2845. else
  2846. {
  2847. res.Success = false;
  2848. res.Message = "请传入参数";
  2849. }
  2850. }
  2851. catch (Exception ex)
  2852. {
  2853. log.Error("参数检验失败:" + ex.ToString());
  2854. res.Success = false;
  2855. res.Message = ex.Message;
  2856. }
  2857. finally
  2858. {
  2859. str = JsonConvert.SerializeObject(res);
  2860. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2861. }
  2862. log.Debug("审核生产退料单返回值:" + str);
  2863. return result;
  2864. }
  2865. /// <summary>
  2866. /// 删除生产退料单
  2867. /// </summary>
  2868. /// <param name="JsonData"></param>
  2869. /// <returns></returns>
  2870. [Route("api/MOIssueDocNegative/Delete")]
  2871. [HttpPost]
  2872. public HttpResponseMessage DeleteMOIssueDocNegatives([FromBody] object JsonData)
  2873. {
  2874. log.Info("接口:api/MOIssueDocNegative/Delete");
  2875. log.Info("删除生产退料单传入值:" + JsonData);
  2876. HttpResponseMessage result = new HttpResponseMessage();
  2877. Result res = new Result();
  2878. string str = string.Empty;
  2879. try
  2880. {
  2881. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2882. {
  2883. try
  2884. {
  2885. List<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>();
  2886. try
  2887. {
  2888. infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(JsonData.ToString());
  2889. }
  2890. catch (Exception ex)
  2891. {
  2892. log.Error("转换失败:" + ex.ToString());
  2893. res.Success = false;
  2894. res.Message = "JSON格式不正确!";
  2895. }
  2896. MOIssueDocNegatives action = new MOIssueDocNegatives();
  2897. string resultStr = action.Delete(infos);
  2898. if (string.IsNullOrWhiteSpace(resultStr))
  2899. {
  2900. res.Success = true;
  2901. res.Message = "接口调用成功!";
  2902. }
  2903. else
  2904. {
  2905. res.Success = false;
  2906. res.Message = resultStr;
  2907. }
  2908. }
  2909. catch (Exception ex)
  2910. {
  2911. log.Error("调用后台失败:" + ex.ToString());
  2912. res.Success = false;
  2913. res.Message = ex.Message;
  2914. }
  2915. }
  2916. else
  2917. {
  2918. res.Success = false;
  2919. res.Message = "请传入参数";
  2920. }
  2921. }
  2922. catch (Exception ex)
  2923. {
  2924. log.Error("参数检验失败:" + ex.ToString());
  2925. res.Success = false;
  2926. res.Message = ex.Message;
  2927. }
  2928. finally
  2929. {
  2930. str = JsonConvert.SerializeObject(res);
  2931. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  2932. }
  2933. log.Debug("删除生产退料单返回值:" + str);
  2934. return result;
  2935. }
  2936. #endregion
  2937. #region 委外订单
  2938. /// <summary>
  2939. /// 获取委外订单
  2940. /// </summary>
  2941. /// <param name="JsonData"></param>
  2942. /// <returns></returns>
  2943. [Route("api/OutsourcingOrder/Get")]
  2944. [HttpPost]
  2945. public HttpResponseMessage GetOutsourcingOrder([FromBody] object JsonData)
  2946. {
  2947. log.Info("接口:api/OutsourcingOrder/Get");
  2948. log.Info("获取委外订单传入值:" + JsonData);
  2949. HttpResponseMessage result = new HttpResponseMessage();
  2950. Result res = new Result();
  2951. string str = string.Empty;
  2952. try
  2953. {
  2954. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  2955. {
  2956. try
  2957. {
  2958. List<ICSOutsourcingOrder> infos = new List<ICSOutsourcingOrder>();
  2959. try
  2960. {
  2961. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingOrder>>(JsonData.ToString());
  2962. }
  2963. catch (Exception ex)
  2964. {
  2965. log.Error("转换失败:" + ex.ToString());
  2966. res.Success = false;
  2967. res.Message = "JSON格式不正确!";
  2968. }
  2969. OutsourcingOrder action = new OutsourcingOrder();
  2970. string resultStr = action.Get(infos);
  2971. if (!string.IsNullOrWhiteSpace(resultStr))
  2972. {
  2973. res.Success = true;
  2974. res.Message = "接口调用成功!";
  2975. res.Data = resultStr;
  2976. }
  2977. else
  2978. {
  2979. res.Success = false;
  2980. res.Message = resultStr;
  2981. }
  2982. }
  2983. catch (Exception ex)
  2984. {
  2985. log.Error("调用后台失败:" + ex.ToString());
  2986. res.Success = false;
  2987. res.Message = ex.Message;
  2988. }
  2989. }
  2990. else
  2991. {
  2992. res.Success = false;
  2993. res.Message = "请传入参数";
  2994. }
  2995. }
  2996. catch (Exception ex)
  2997. {
  2998. log.Error("参数检验失败:" + ex.ToString());
  2999. res.Success = false;
  3000. res.Message = ex.Message;
  3001. }
  3002. finally
  3003. {
  3004. str = JsonConvert.SerializeObject(res);
  3005. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3006. }
  3007. log.Debug("获取委外订单返回值:" + str);
  3008. return result;
  3009. }
  3010. #endregion
  3011. #region 委外订单备料表
  3012. /// <summary>
  3013. /// 获取委外订单备料表
  3014. /// </summary>
  3015. /// <param name="JsonData"></param>
  3016. /// <returns></returns>
  3017. [Route("api/OutsourcingOrderPick/Get")]
  3018. [HttpPost]
  3019. public HttpResponseMessage GetOutsourcingOrderPick([FromBody] object JsonData)
  3020. {
  3021. log.Info("接口:api/OutsourcingOrderPick/Get");
  3022. log.Info("获取委外订单备料表传入值:" + JsonData);
  3023. HttpResponseMessage result = new HttpResponseMessage();
  3024. Result res = new Result();
  3025. string str = string.Empty;
  3026. try
  3027. {
  3028. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3029. {
  3030. try
  3031. {
  3032. List<ICSOutsourcingOrderPick> infos = new List<ICSOutsourcingOrderPick>();
  3033. try
  3034. {
  3035. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingOrderPick>>(JsonData.ToString());
  3036. }
  3037. catch (Exception ex)
  3038. {
  3039. log.Error("转换失败:" + ex.ToString());
  3040. res.Success = false;
  3041. res.Message = "JSON格式不正确!";
  3042. }
  3043. OutsourcingOrderPick action = new OutsourcingOrderPick();
  3044. string resultStr = action.Get(infos);
  3045. if (!string.IsNullOrWhiteSpace(resultStr))
  3046. {
  3047. res.Success = true;
  3048. res.Message = "接口调用成功!";
  3049. res.Data = resultStr;
  3050. }
  3051. else
  3052. {
  3053. res.Success = false;
  3054. res.Message = resultStr;
  3055. }
  3056. }
  3057. catch (Exception ex)
  3058. {
  3059. log.Error("调用后台失败:" + ex.ToString());
  3060. res.Success = false;
  3061. res.Message = ex.Message;
  3062. }
  3063. }
  3064. else
  3065. {
  3066. res.Success = false;
  3067. res.Message = "请传入参数";
  3068. }
  3069. }
  3070. catch (Exception ex)
  3071. {
  3072. log.Error("参数检验失败:" + ex.ToString());
  3073. res.Success = false;
  3074. res.Message = ex.Message;
  3075. }
  3076. finally
  3077. {
  3078. str = JsonConvert.SerializeObject(res);
  3079. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3080. }
  3081. log.Debug("获取委外订单备料表返回值:" + str);
  3082. return result;
  3083. }
  3084. #endregion
  3085. #region 委外发料
  3086. /// <summary>
  3087. /// 获取委外发料
  3088. /// </summary>
  3089. /// <param name="JsonData"></param>
  3090. /// <returns></returns>
  3091. [Route("api/OutsourcingIssueDoc/Get")]
  3092. [HttpPost]
  3093. public HttpResponseMessage GetOutsourcingIssueDoc([FromBody] object JsonData)
  3094. {
  3095. log.Info("接口:api/OutsourcingIssueDoc/Get");
  3096. log.Info("获取委外发料传入值:" + JsonData);
  3097. HttpResponseMessage result = new HttpResponseMessage();
  3098. Result res = new Result();
  3099. string str = string.Empty;
  3100. try
  3101. {
  3102. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3103. {
  3104. try
  3105. {
  3106. List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
  3107. try
  3108. {
  3109. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
  3110. }
  3111. catch (Exception ex)
  3112. {
  3113. log.Error("转换失败:" + ex.ToString());
  3114. res.Success = false;
  3115. res.Message = "JSON格式不正确!";
  3116. }
  3117. OutsourcingIssueDoc action = new OutsourcingIssueDoc();
  3118. string resultStr = action.Get(infos);
  3119. if (!string.IsNullOrWhiteSpace(resultStr))
  3120. {
  3121. res.Success = true;
  3122. res.Message = "接口调用成功!";
  3123. res.Data = resultStr;
  3124. }
  3125. else
  3126. {
  3127. res.Success = false;
  3128. res.Message = resultStr;
  3129. }
  3130. }
  3131. catch (Exception ex)
  3132. {
  3133. log.Error("调用后台失败:" + ex.ToString());
  3134. res.Success = false;
  3135. res.Message = ex.Message;
  3136. }
  3137. }
  3138. else
  3139. {
  3140. res.Success = false;
  3141. res.Message = "请传入参数";
  3142. }
  3143. }
  3144. catch (Exception ex)
  3145. {
  3146. log.Error("参数检验失败:" + ex.ToString());
  3147. res.Success = false;
  3148. res.Message = ex.Message;
  3149. }
  3150. finally
  3151. {
  3152. str = JsonConvert.SerializeObject(res);
  3153. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3154. }
  3155. log.Debug("获取委外发料返回值:" + str);
  3156. return result;
  3157. }
  3158. /// <summary>
  3159. /// 创建委外发料单
  3160. /// </summary>
  3161. /// <param name="JsonData"></param>
  3162. /// <returns></returns>
  3163. [Route("api/OutsourcingIssueDoc/Create")]
  3164. [HttpPost]
  3165. public HttpResponseMessage CreateOutsourcingIssueDoc([FromBody] object JsonData)
  3166. {
  3167. log.Info("接口:api/OutsourcingIssueDoc/Create");
  3168. log.Info("创建委外发料单传入值:" + JsonData);
  3169. HttpResponseMessage result = new HttpResponseMessage();
  3170. Result res = new Result();
  3171. string str = string.Empty;
  3172. try
  3173. {
  3174. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3175. {
  3176. try
  3177. {
  3178. List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
  3179. try
  3180. {
  3181. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
  3182. }
  3183. catch (Exception ex)
  3184. {
  3185. log.Error("转换失败:" + ex.ToString());
  3186. res.Success = false;
  3187. res.Message = "JSON格式不正确!";
  3188. }
  3189. OutsourcingIssueDoc action = new OutsourcingIssueDoc();
  3190. string resultStr = action.CreateOutsourcingIssueDoc(infos);
  3191. if (!string.IsNullOrWhiteSpace(resultStr))
  3192. {
  3193. res.Success = true;
  3194. res.Message = "接口调用成功!";
  3195. res.Data = resultStr;
  3196. }
  3197. else
  3198. {
  3199. res.Success = false;
  3200. res.Message = resultStr;
  3201. }
  3202. }
  3203. catch (Exception ex)
  3204. {
  3205. log.Error("调用后台失败:" + ex.ToString());
  3206. res.Success = false;
  3207. res.Message = ex.Message;
  3208. }
  3209. }
  3210. else
  3211. {
  3212. res.Success = false;
  3213. res.Message = "请传入参数";
  3214. }
  3215. }
  3216. catch (Exception ex)
  3217. {
  3218. log.Error("参数检验失败:" + ex.ToString());
  3219. res.Success = false;
  3220. res.Message = ex.Message;
  3221. }
  3222. finally
  3223. {
  3224. str = JsonConvert.SerializeObject(res);
  3225. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3226. }
  3227. log.Debug("创建委外发料单返回值:" + str);
  3228. return result;
  3229. }
  3230. /// <summary>
  3231. /// 审核委外发料单
  3232. /// </summary>
  3233. /// <param name="JsonData"></param>
  3234. /// <returns></returns>
  3235. [Route("api/OutsourcingIssueDoc/Approve")]
  3236. [HttpPost]
  3237. public HttpResponseMessage ApproveOutsourcingIssueDoc([FromBody] object JsonData)
  3238. {
  3239. log.Info("接口:api/OutsourcingIssueDoc/Approve");
  3240. log.Info("审核委外发料单传入值:" + JsonData);
  3241. HttpResponseMessage result = new HttpResponseMessage();
  3242. Result res = new Result();
  3243. string str = string.Empty;
  3244. try
  3245. {
  3246. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3247. {
  3248. try
  3249. {
  3250. List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
  3251. try
  3252. {
  3253. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
  3254. }
  3255. catch (Exception ex)
  3256. {
  3257. log.Error("转换失败:" + ex.ToString());
  3258. res.Success = false;
  3259. res.Message = "JSON格式不正确!";
  3260. }
  3261. OutsourcingIssueDoc action = new OutsourcingIssueDoc();
  3262. string resultStr = action.Approve(infos);
  3263. if (string.IsNullOrWhiteSpace(resultStr))
  3264. {
  3265. res.Success = true;
  3266. res.Message = "接口调用成功!";
  3267. }
  3268. else
  3269. {
  3270. res.Success = false;
  3271. res.Message = resultStr;
  3272. }
  3273. }
  3274. catch (Exception ex)
  3275. {
  3276. log.Error("调用后台失败:" + ex.ToString());
  3277. res.Success = false;
  3278. res.Message = ex.Message;
  3279. }
  3280. }
  3281. else
  3282. {
  3283. res.Success = false;
  3284. res.Message = "请传入参数";
  3285. }
  3286. }
  3287. catch (Exception ex)
  3288. {
  3289. log.Error("参数检验失败:" + ex.ToString());
  3290. res.Success = false;
  3291. res.Message = ex.Message;
  3292. }
  3293. finally
  3294. {
  3295. str = JsonConvert.SerializeObject(res);
  3296. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3297. }
  3298. log.Debug("审核委外发料单返回值:" + str);
  3299. return result;
  3300. }
  3301. /// <summary>
  3302. /// 删除委外发料单
  3303. /// </summary>
  3304. /// <param name="JsonData"></param>
  3305. /// <returns></returns>
  3306. [Route("api/OutsourcingIssueDoc/Delete")]
  3307. [HttpPost]
  3308. public HttpResponseMessage DeleteOutsourcingIssueDoc([FromBody] object JsonData)
  3309. {
  3310. log.Info("接口:api/OutsourcingIssueDoc/Delete");
  3311. log.Info("删除委外发料单传入值:" + JsonData);
  3312. HttpResponseMessage result = new HttpResponseMessage();
  3313. Result res = new Result();
  3314. string str = string.Empty;
  3315. try
  3316. {
  3317. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3318. {
  3319. try
  3320. {
  3321. List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
  3322. try
  3323. {
  3324. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
  3325. }
  3326. catch (Exception ex)
  3327. {
  3328. log.Error("转换失败:" + ex.ToString());
  3329. res.Success = false;
  3330. res.Message = "JSON格式不正确!";
  3331. }
  3332. OutsourcingIssueDoc action = new OutsourcingIssueDoc();
  3333. string resultStr = action.Delete(infos);
  3334. if (string.IsNullOrWhiteSpace(resultStr))
  3335. {
  3336. res.Success = true;
  3337. res.Message = "接口调用成功!";
  3338. }
  3339. else
  3340. {
  3341. res.Success = false;
  3342. res.Message = resultStr;
  3343. }
  3344. }
  3345. catch (Exception ex)
  3346. {
  3347. log.Error("调用后台失败:" + ex.ToString());
  3348. res.Success = false;
  3349. res.Message = ex.Message;
  3350. }
  3351. }
  3352. else
  3353. {
  3354. res.Success = false;
  3355. res.Message = "请传入参数";
  3356. }
  3357. }
  3358. catch (Exception ex)
  3359. {
  3360. log.Error("参数检验失败:" + ex.ToString());
  3361. res.Success = false;
  3362. res.Message = ex.Message;
  3363. }
  3364. finally
  3365. {
  3366. str = JsonConvert.SerializeObject(res);
  3367. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3368. }
  3369. log.Debug("删除委外发料单返回值:" + str);
  3370. return result;
  3371. }
  3372. #endregion
  3373. #region 委外退料
  3374. /// <summary>
  3375. /// 获取委外退料
  3376. /// </summary>
  3377. /// <param name="JsonData"></param>
  3378. /// <returns></returns>
  3379. [Route("api/OutsourcingIssueDoNegative/Get")]
  3380. [HttpPost]
  3381. public HttpResponseMessage GetOutsourcingIssueDoNegative([FromBody] object JsonData)
  3382. {
  3383. log.Info("接口:api/OutsourcingIssueDoNegative/Get");
  3384. log.Info("获取委外退料传入值:" + JsonData);
  3385. HttpResponseMessage result = new HttpResponseMessage();
  3386. Result res = new Result();
  3387. string str = string.Empty;
  3388. try
  3389. {
  3390. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3391. {
  3392. try
  3393. {
  3394. List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
  3395. try
  3396. {
  3397. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
  3398. }
  3399. catch (Exception ex)
  3400. {
  3401. log.Error("转换失败:" + ex.ToString());
  3402. res.Success = false;
  3403. res.Message = "JSON格式不正确!";
  3404. }
  3405. OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
  3406. string resultStr = action.Get(infos);
  3407. if (!string.IsNullOrWhiteSpace(resultStr))
  3408. {
  3409. res.Success = true;
  3410. res.Message = "接口调用成功!";
  3411. res.Data = resultStr;
  3412. }
  3413. else
  3414. {
  3415. res.Success = false;
  3416. res.Message = resultStr;
  3417. }
  3418. }
  3419. catch (Exception ex)
  3420. {
  3421. log.Error("调用后台失败:" + ex.ToString());
  3422. res.Success = false;
  3423. res.Message = ex.Message;
  3424. }
  3425. }
  3426. else
  3427. {
  3428. res.Success = false;
  3429. res.Message = "请传入参数";
  3430. }
  3431. }
  3432. catch (Exception ex)
  3433. {
  3434. log.Error("参数检验失败:" + ex.ToString());
  3435. res.Success = false;
  3436. res.Message = ex.Message;
  3437. }
  3438. finally
  3439. {
  3440. str = JsonConvert.SerializeObject(res);
  3441. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3442. }
  3443. log.Debug("获取委外退料返回值:" + str);
  3444. return result;
  3445. }
  3446. /// <summary>
  3447. /// 创建委外退料
  3448. /// </summary>
  3449. /// <param name="JsonData"></param>
  3450. /// <returns></returns>
  3451. [Route("api/OutsourcingIssueDoNegative/Create")]
  3452. [HttpPost]
  3453. public HttpResponseMessage CreateOutsourcingIssueDoNegative([FromBody] object JsonData)
  3454. {
  3455. log.Info("接口:api/OutsourcingIssueDoNegative/Create");
  3456. log.Info("创建委外退料传入值:" + JsonData);
  3457. HttpResponseMessage result = new HttpResponseMessage();
  3458. Result res = new Result();
  3459. string str = string.Empty;
  3460. try
  3461. {
  3462. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3463. {
  3464. try
  3465. {
  3466. List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
  3467. try
  3468. {
  3469. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
  3470. }
  3471. catch (Exception ex)
  3472. {
  3473. log.Error("转换失败:" + ex.ToString());
  3474. res.Success = false;
  3475. res.Message = "JSON格式不正确!";
  3476. }
  3477. OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
  3478. string resultStr = action.CreateOutsourcingIssueDoNegative(infos);
  3479. if (!string.IsNullOrWhiteSpace(resultStr))
  3480. {
  3481. res.Success = true;
  3482. res.Message = "接口调用成功!";
  3483. res.Data = resultStr;
  3484. }
  3485. else
  3486. {
  3487. res.Success = false;
  3488. res.Message = resultStr;
  3489. }
  3490. }
  3491. catch (Exception ex)
  3492. {
  3493. log.Error("调用后台失败:" + ex.ToString());
  3494. res.Success = false;
  3495. res.Message = ex.Message;
  3496. }
  3497. }
  3498. else
  3499. {
  3500. res.Success = false;
  3501. res.Message = "请传入参数";
  3502. }
  3503. }
  3504. catch (Exception ex)
  3505. {
  3506. log.Error("参数检验失败:" + ex.ToString());
  3507. res.Success = false;
  3508. res.Message = ex.Message;
  3509. }
  3510. finally
  3511. {
  3512. str = JsonConvert.SerializeObject(res);
  3513. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3514. }
  3515. log.Debug("创建委外退料返回值:" + str);
  3516. return result;
  3517. }
  3518. /// <summary>
  3519. /// 审核委外退料
  3520. /// </summary>
  3521. /// <param name="JsonData"></param>
  3522. /// <returns></returns>
  3523. [Route("api/OutsourcingIssueDoNegative/Approve")]
  3524. [HttpPost]
  3525. public HttpResponseMessage ApproveOutsourcingIssueDoNegative([FromBody] object JsonData)
  3526. {
  3527. log.Info("接口:api/OutsourcingIssueDoNegative/Approve");
  3528. log.Info("审核委外退料传入值:" + JsonData);
  3529. HttpResponseMessage result = new HttpResponseMessage();
  3530. Result res = new Result();
  3531. string str = string.Empty;
  3532. try
  3533. {
  3534. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3535. {
  3536. try
  3537. {
  3538. List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
  3539. try
  3540. {
  3541. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
  3542. }
  3543. catch (Exception ex)
  3544. {
  3545. log.Error("转换失败:" + ex.ToString());
  3546. res.Success = false;
  3547. res.Message = "JSON格式不正确!";
  3548. }
  3549. OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
  3550. string resultStr = action.Approve(infos);
  3551. if (!string.IsNullOrWhiteSpace(resultStr))
  3552. {
  3553. res.Success = true;
  3554. res.Message = "接口调用成功!";
  3555. }
  3556. else
  3557. {
  3558. res.Success = false;
  3559. res.Message = resultStr;
  3560. }
  3561. }
  3562. catch (Exception ex)
  3563. {
  3564. log.Error("调用后台失败:" + ex.ToString());
  3565. res.Success = false;
  3566. res.Message = ex.Message;
  3567. }
  3568. }
  3569. else
  3570. {
  3571. res.Success = false;
  3572. res.Message = "请传入参数";
  3573. }
  3574. }
  3575. catch (Exception ex)
  3576. {
  3577. log.Error("参数检验失败:" + ex.ToString());
  3578. res.Success = false;
  3579. res.Message = ex.Message;
  3580. }
  3581. finally
  3582. {
  3583. str = JsonConvert.SerializeObject(res);
  3584. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3585. }
  3586. log.Debug("审核委外退料返回值:" + str);
  3587. return result;
  3588. }
  3589. /// <summary>
  3590. /// 删除委外退料
  3591. /// </summary>
  3592. /// <param name="JsonData"></param>
  3593. /// <returns></returns>
  3594. [Route("api/OutsourcingIssueDoNegative/Delete")]
  3595. [HttpPost]
  3596. public HttpResponseMessage DeleteOutsourcingIssueDoNegative([FromBody] object JsonData)
  3597. {
  3598. log.Info("接口:api/OutsourcingIssueDoNegative/Delete");
  3599. log.Info("删除委外退料传入值:" + JsonData);
  3600. HttpResponseMessage result = new HttpResponseMessage();
  3601. Result res = new Result();
  3602. string str = string.Empty;
  3603. try
  3604. {
  3605. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3606. {
  3607. try
  3608. {
  3609. List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
  3610. try
  3611. {
  3612. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
  3613. }
  3614. catch (Exception ex)
  3615. {
  3616. log.Error("转换失败:" + ex.ToString());
  3617. res.Success = false;
  3618. res.Message = "JSON格式不正确!";
  3619. }
  3620. OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
  3621. string resultStr = action.Delete(infos);
  3622. if (!string.IsNullOrWhiteSpace(resultStr))
  3623. {
  3624. res.Success = true;
  3625. res.Message = "接口调用成功!";
  3626. }
  3627. else
  3628. {
  3629. res.Success = false;
  3630. res.Message = resultStr;
  3631. }
  3632. }
  3633. catch (Exception ex)
  3634. {
  3635. log.Error("调用后台失败:" + ex.ToString());
  3636. res.Success = false;
  3637. res.Message = ex.Message;
  3638. }
  3639. }
  3640. else
  3641. {
  3642. res.Success = false;
  3643. res.Message = "请传入参数";
  3644. }
  3645. }
  3646. catch (Exception ex)
  3647. {
  3648. log.Error("参数检验失败:" + ex.ToString());
  3649. res.Success = false;
  3650. res.Message = ex.Message;
  3651. }
  3652. finally
  3653. {
  3654. str = JsonConvert.SerializeObject(res);
  3655. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3656. }
  3657. log.Debug("删除委外退料返回值:" + str);
  3658. return result;
  3659. }
  3660. #endregion
  3661. #region 委外到货单
  3662. /// <summary>
  3663. /// 获取委外到货单
  3664. /// </summary>
  3665. /// <param name="JsonData"></param>
  3666. /// <returns></returns>
  3667. [Route("api/DeliveryNotice/Get")]
  3668. [HttpPost]
  3669. public HttpResponseMessage GetDeliveryNotice([FromBody] object JsonData)
  3670. {
  3671. log.Info("接口:api/DeliveryNotice/Get");
  3672. log.Info("获取委外到货单传入值:" + JsonData);
  3673. HttpResponseMessage result = new HttpResponseMessage();
  3674. Result res = new Result();
  3675. string str = string.Empty;
  3676. try
  3677. {
  3678. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3679. {
  3680. try
  3681. {
  3682. List<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>();
  3683. try
  3684. {
  3685. infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(JsonData.ToString());
  3686. }
  3687. catch (Exception ex)
  3688. {
  3689. log.Error("转换失败:" + ex.ToString());
  3690. res.Success = false;
  3691. res.Message = "JSON格式不正确!";
  3692. }
  3693. DeliveryNotice action = new DeliveryNotice();
  3694. string resultStr = action.Get(infos);
  3695. if (!string.IsNullOrWhiteSpace(resultStr))
  3696. {
  3697. res.Success = true;
  3698. res.Message = "接口调用成功!";
  3699. res.Data = resultStr;
  3700. }
  3701. else
  3702. {
  3703. res.Success = false;
  3704. res.Message = resultStr;
  3705. }
  3706. }
  3707. catch (Exception ex)
  3708. {
  3709. log.Error("调用后台失败:" + ex.ToString());
  3710. res.Success = false;
  3711. res.Message = ex.Message;
  3712. }
  3713. }
  3714. else
  3715. {
  3716. res.Success = false;
  3717. res.Message = "请传入参数";
  3718. }
  3719. }
  3720. catch (Exception ex)
  3721. {
  3722. log.Error("参数检验失败:" + ex.ToString());
  3723. res.Success = false;
  3724. res.Message = ex.Message;
  3725. }
  3726. finally
  3727. {
  3728. str = JsonConvert.SerializeObject(res);
  3729. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3730. }
  3731. log.Debug("获取委外到货单返回值:" + str);
  3732. return result;
  3733. }
  3734. /// <summary>
  3735. /// 创建委外到货单
  3736. /// </summary>
  3737. /// <param name="JsonData"></param>
  3738. /// <returns></returns>
  3739. [Route("api/DeliveryNotice/Create")]
  3740. [HttpPost]
  3741. public HttpResponseMessage CreateDeliveryNotice([FromBody] object JsonData)
  3742. {
  3743. log.Info("接口:api/DeliveryNotice/Create");
  3744. log.Info("创建委外到货单传入值:" + JsonData);
  3745. HttpResponseMessage result = new HttpResponseMessage();
  3746. Result res = new Result();
  3747. string str = string.Empty;
  3748. try
  3749. {
  3750. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3751. {
  3752. try
  3753. {
  3754. List<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>();
  3755. try
  3756. {
  3757. infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(JsonData.ToString());
  3758. }
  3759. catch (Exception ex)
  3760. {
  3761. log.Error("转换失败:" + ex.ToString());
  3762. res.Success = false;
  3763. res.Message = "JSON格式不正确!";
  3764. throw new Exception(res.Message);
  3765. }
  3766. DeliveryNotice action = new DeliveryNotice();
  3767. string resultStr = action.CreatePUArrive(infos);
  3768. if (!string.IsNullOrWhiteSpace(resultStr))
  3769. {
  3770. res.Success = true;
  3771. res.Message = "接口调用成功!";
  3772. res.Data = resultStr;
  3773. }
  3774. else
  3775. {
  3776. res.Success = false;
  3777. res.Message = resultStr;
  3778. }
  3779. }
  3780. catch (Exception ex)
  3781. {
  3782. log.Error("调用后台失败:" + ex.ToString());
  3783. res.Success = false;
  3784. res.Message = ex.Message;
  3785. }
  3786. }
  3787. else
  3788. {
  3789. res.Success = false;
  3790. res.Message = "请传入参数";
  3791. }
  3792. }
  3793. catch (Exception ex)
  3794. {
  3795. log.Error("参数检验失败:" + ex.ToString());
  3796. res.Success = false;
  3797. res.Message = ex.Message;
  3798. }
  3799. finally
  3800. {
  3801. str = JsonConvert.SerializeObject(res);
  3802. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3803. }
  3804. log.Debug("创建委外到货单返回值:" + str);
  3805. return result;
  3806. }
  3807. /// <summary>
  3808. /// 审核委外到货
  3809. /// </summary>
  3810. /// <param name="JsonData"></param>
  3811. /// <returns></returns>
  3812. [Route("api/DeliveryNotice/Approve")]
  3813. [HttpPost]
  3814. public HttpResponseMessage ApproveDeliveryNotice([FromBody] object JsonData)
  3815. {
  3816. log.Info("接口:api/DeliveryNotice/Approve");
  3817. log.Info("审核委外到货传入值:" + JsonData);
  3818. HttpResponseMessage result = new HttpResponseMessage();
  3819. Result res = new Result();
  3820. string str = string.Empty;
  3821. try
  3822. {
  3823. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3824. {
  3825. try
  3826. {
  3827. List<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>();
  3828. try
  3829. {
  3830. infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(JsonData.ToString());
  3831. }
  3832. catch (Exception ex)
  3833. {
  3834. log.Error("转换失败:" + ex.ToString());
  3835. res.Success = false;
  3836. res.Message = "JSON格式不正确!";
  3837. }
  3838. DeliveryNotice action = new DeliveryNotice();
  3839. string resultStr = action.Approve(infos);
  3840. if (string.IsNullOrWhiteSpace(resultStr))
  3841. {
  3842. res.Success = true;
  3843. res.Message = "接口调用成功!";
  3844. }
  3845. else
  3846. {
  3847. res.Success = false;
  3848. res.Message = resultStr;
  3849. }
  3850. }
  3851. catch (Exception ex)
  3852. {
  3853. log.Error("调用后台失败:" + ex.ToString());
  3854. res.Success = false;
  3855. res.Message = ex.Message;
  3856. }
  3857. }
  3858. else
  3859. {
  3860. res.Success = false;
  3861. res.Message = "请传入参数";
  3862. }
  3863. }
  3864. catch (Exception ex)
  3865. {
  3866. log.Error("参数检验失败:" + ex.ToString());
  3867. res.Success = false;
  3868. res.Message = ex.Message;
  3869. }
  3870. finally
  3871. {
  3872. str = JsonConvert.SerializeObject(res);
  3873. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3874. }
  3875. log.Debug("审核委外到货返回值:" + str);
  3876. return result;
  3877. }
  3878. /// <summary>
  3879. /// 删除委外到货单
  3880. /// </summary>
  3881. /// <param name="JsonData"></param>
  3882. /// <returns></returns>
  3883. [Route("api/DeliveryNotice/Delete")]
  3884. [HttpPost]
  3885. public HttpResponseMessage DeleteDeliveryNotice([FromBody] object JsonData)
  3886. {
  3887. log.Info("接口:api/DeliveryNotice/Delete");
  3888. log.Info("删除委外到货单传入值:" + JsonData);
  3889. HttpResponseMessage result = new HttpResponseMessage();
  3890. Result res = new Result();
  3891. string str = string.Empty;
  3892. try
  3893. {
  3894. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3895. {
  3896. try
  3897. {
  3898. List<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>();
  3899. try
  3900. {
  3901. infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(JsonData.ToString());
  3902. }
  3903. catch (Exception ex)
  3904. {
  3905. log.Error("转换失败:" + ex.ToString());
  3906. res.Success = false;
  3907. res.Message = "JSON格式不正确!";
  3908. }
  3909. DeliveryNotice action = new DeliveryNotice();
  3910. string resultStr = action.Delete(infos);
  3911. if (string.IsNullOrWhiteSpace(resultStr))
  3912. {
  3913. res.Success = true;
  3914. res.Message = "接口调用成功!";
  3915. }
  3916. else
  3917. {
  3918. res.Success = false;
  3919. res.Message = resultStr;
  3920. }
  3921. }
  3922. catch (Exception ex)
  3923. {
  3924. log.Error("调用后台失败:" + ex.ToString());
  3925. res.Success = false;
  3926. res.Message = ex.Message;
  3927. }
  3928. }
  3929. else
  3930. {
  3931. res.Success = false;
  3932. res.Message = "请传入参数";
  3933. }
  3934. }
  3935. catch (Exception ex)
  3936. {
  3937. log.Error("参数检验失败:" + ex.ToString());
  3938. res.Success = false;
  3939. res.Message = ex.Message;
  3940. }
  3941. finally
  3942. {
  3943. str = JsonConvert.SerializeObject(res);
  3944. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  3945. }
  3946. log.Debug("删除委外到货单返回值:" + str);
  3947. return result;
  3948. }
  3949. #endregion
  3950. #region 委外采购入库单
  3951. /// <summary>
  3952. /// 获取委外采购入库单
  3953. /// </summary>
  3954. /// <param name="JsonData"></param>
  3955. /// <returns></returns>
  3956. [Route("api/OutsourcingReceiveDoc/Get")]
  3957. [HttpPost]
  3958. public HttpResponseMessage GetOutsourcingReceiveDoc([FromBody] object JsonData)
  3959. {
  3960. log.Info("接口:api/OutsourcingReceiveDoc/Get");
  3961. log.Info("获取委外采购入库单传入值:" + JsonData);
  3962. HttpResponseMessage result = new HttpResponseMessage();
  3963. Result res = new Result();
  3964. string str = string.Empty;
  3965. try
  3966. {
  3967. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  3968. {
  3969. try
  3970. {
  3971. List<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>();
  3972. try
  3973. {
  3974. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(JsonData.ToString());
  3975. }
  3976. catch (Exception ex)
  3977. {
  3978. log.Error("转换失败:" + ex.ToString());
  3979. res.Success = false;
  3980. res.Message = "JSON格式不正确!";
  3981. }
  3982. OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
  3983. string resultStr = action.Get(infos);
  3984. if (!string.IsNullOrWhiteSpace(resultStr))
  3985. {
  3986. res.Success = true;
  3987. res.Message = "接口调用成功!";
  3988. res.Data = resultStr;
  3989. }
  3990. else
  3991. {
  3992. res.Success = false;
  3993. res.Message = "接口调用失败";
  3994. }
  3995. }
  3996. catch (Exception ex)
  3997. {
  3998. log.Error("调用后台失败:" + ex.ToString());
  3999. res.Success = false;
  4000. res.Message = ex.Message;
  4001. }
  4002. }
  4003. else
  4004. {
  4005. res.Success = false;
  4006. res.Message = "请传入参数";
  4007. }
  4008. }
  4009. catch (Exception ex)
  4010. {
  4011. log.Error("参数检验失败:" + ex.ToString());
  4012. res.Success = false;
  4013. res.Message = ex.Message;
  4014. }
  4015. finally
  4016. {
  4017. str = JsonConvert.SerializeObject(res);
  4018. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4019. }
  4020. log.Debug("获取委外采购入库单返回值:" + str);
  4021. return result;
  4022. }
  4023. /// <summary>
  4024. /// 创建委外采购入库单
  4025. /// </summary>
  4026. /// <param name="JsonData"></param>
  4027. /// <returns></returns>
  4028. [Route("api/OutsourcingReceiveDocPOArrive/Create")]
  4029. [HttpPost]
  4030. public HttpResponseMessage CreateOutsourcingReceiveDoc([FromBody] object JsonData)
  4031. {
  4032. log.Info("接口:api/OutsourcingReceiveDocPOArrive/Create");
  4033. log.Info("创建委外采购入库单传入值:" + JsonData);
  4034. HttpResponseMessage result = new HttpResponseMessage();
  4035. Result res = new Result();
  4036. string str = string.Empty;
  4037. try
  4038. {
  4039. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4040. {
  4041. try
  4042. {
  4043. List<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>();
  4044. try
  4045. {
  4046. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(JsonData.ToString());
  4047. }
  4048. catch (Exception ex)
  4049. {
  4050. log.Error("转换失败:" + ex.ToString());
  4051. res.Success = false;
  4052. res.Message = "JSON格式不正确!";
  4053. throw new Exception(res.Message);
  4054. }
  4055. OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
  4056. string resultStr = action.CreateOutsourcingReceiveDocByPOArrive(infos);
  4057. if (!string.IsNullOrWhiteSpace(resultStr))
  4058. {
  4059. res.Success = true;
  4060. res.Message = "接口调用成功!";
  4061. res.Data = resultStr;
  4062. }
  4063. else
  4064. {
  4065. res.Success = false;
  4066. res.Data = resultStr;
  4067. }
  4068. }
  4069. catch (Exception ex)
  4070. {
  4071. log.Error("调用后台失败:" + ex.ToString());
  4072. res.Success = false;
  4073. res.Message = ex.Message;
  4074. }
  4075. }
  4076. else
  4077. {
  4078. res.Success = false;
  4079. res.Message = "请传入参数";
  4080. }
  4081. }
  4082. catch (Exception ex)
  4083. {
  4084. log.Error("参数检验失败:" + ex.ToString());
  4085. res.Success = false;
  4086. res.Message = ex.Message;
  4087. }
  4088. finally
  4089. {
  4090. str = JsonConvert.SerializeObject(res);
  4091. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4092. }
  4093. log.Debug("创建委外采购入库单返回值:" + str);
  4094. return result;
  4095. }
  4096. [Route("api/OutsourcingReceiveDoc/Create")]
  4097. [HttpPost]
  4098. public HttpResponseMessage CreateOutsourcingReceiveDocPO([FromBody] object JsonData)
  4099. {
  4100. log.Info("接口:api/OutsourcingReceiveDoc/Create");
  4101. log.Info("创建委外采购入(委外到货单)传入值:" + JsonData);
  4102. HttpResponseMessage result = new HttpResponseMessage();
  4103. Result res = new Result();
  4104. string str = string.Empty;
  4105. try
  4106. {
  4107. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4108. {
  4109. try
  4110. {
  4111. List<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>();
  4112. try
  4113. {
  4114. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(JsonData.ToString());
  4115. }
  4116. catch (Exception ex)
  4117. {
  4118. log.Error("转换失败:" + ex.ToString());
  4119. res.Success = false;
  4120. res.Message = "JSON格式不正确!";
  4121. throw new Exception(res.Message);
  4122. }
  4123. OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
  4124. string resultStr = action.CreateOutsourcingReceiveDocByPO(infos);
  4125. if (!string.IsNullOrWhiteSpace(resultStr))
  4126. {
  4127. res.Success = true;
  4128. res.Message = "接口调用成功!";
  4129. res.Data = resultStr;
  4130. }
  4131. else
  4132. {
  4133. res.Success = false;
  4134. res.Data = resultStr;
  4135. }
  4136. }
  4137. catch (Exception ex)
  4138. {
  4139. log.Error("调用后台失败:" + ex.ToString());
  4140. res.Success = false;
  4141. res.Message = ex.Message;
  4142. }
  4143. }
  4144. else
  4145. {
  4146. res.Success = false;
  4147. res.Message = "请传入参数";
  4148. }
  4149. }
  4150. catch (Exception ex)
  4151. {
  4152. log.Error("参数检验失败:" + ex.ToString());
  4153. res.Success = false;
  4154. res.Message = ex.Message;
  4155. }
  4156. finally
  4157. {
  4158. str = JsonConvert.SerializeObject(res);
  4159. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4160. }
  4161. log.Debug("创建委外采购入(委外到货单)返回值:" + str);
  4162. return result;
  4163. }
  4164. /// <summary>
  4165. /// 审核委外采购入库单
  4166. /// </summary>
  4167. /// <param name="JsonData"></param>
  4168. /// <returns></returns>
  4169. [Route("api/OutsourcingReceiveDoc/Approve")]
  4170. [HttpPost]
  4171. public HttpResponseMessage ApproveOutsourcingReceiveDoc([FromBody] object JsonData)
  4172. {
  4173. log.Info("接口:api/OutsourcingReceiveDoc/Approve");
  4174. log.Info("审核委外采购入库单传入值:" + JsonData);
  4175. HttpResponseMessage result = new HttpResponseMessage();
  4176. Result res = new Result();
  4177. string str = string.Empty;
  4178. try
  4179. {
  4180. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4181. {
  4182. try
  4183. {
  4184. List<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>();
  4185. try
  4186. {
  4187. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(JsonData.ToString());
  4188. }
  4189. catch (Exception ex)
  4190. {
  4191. log.Error("转换失败:" + ex.ToString());
  4192. res.Success = false;
  4193. res.Message = "JSON格式不正确!";
  4194. }
  4195. OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
  4196. string resultStr = action.Approve(infos);
  4197. if (resultStr.Length > 0)
  4198. {
  4199. res.Success = true;
  4200. res.Message = "接口调用成功!";
  4201. res.Data = resultStr;
  4202. }
  4203. else
  4204. {
  4205. res.Success = false;
  4206. res.Message = "接口调用失败";
  4207. }
  4208. }
  4209. catch (Exception ex)
  4210. {
  4211. log.Error("调用后台失败:" + ex.ToString());
  4212. res.Success = false;
  4213. res.Message = ex.Message;
  4214. }
  4215. }
  4216. else
  4217. {
  4218. res.Success = false;
  4219. res.Message = "请传入参数";
  4220. }
  4221. }
  4222. catch (Exception ex)
  4223. {
  4224. log.Error("参数检验失败:" + ex.ToString());
  4225. res.Success = false;
  4226. res.Message = ex.Message;
  4227. }
  4228. finally
  4229. {
  4230. str = JsonConvert.SerializeObject(res);
  4231. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4232. }
  4233. log.Debug("审核委外采购入库单返回值:" + str);
  4234. return result;
  4235. }
  4236. /// <summary>
  4237. /// 删除采购入库单
  4238. /// </summary>
  4239. /// <param name="JsonData"></param>
  4240. /// <returns></returns>
  4241. [Route("api/PurchaseReceiveDoc/Delete")]
  4242. [HttpPost]
  4243. public HttpResponseMessage DeleteOutsourcingReceiveDoc([FromBody] object JsonData)
  4244. {
  4245. log.Info("接口:api/PurchaseReceiveDoc/Delete");
  4246. log.Info("删除采购入库单传入值:" + JsonData);
  4247. HttpResponseMessage result = new HttpResponseMessage();
  4248. Result res = new Result();
  4249. string str = string.Empty;
  4250. try
  4251. {
  4252. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4253. {
  4254. try
  4255. {
  4256. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  4257. try
  4258. {
  4259. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  4260. }
  4261. catch (Exception ex)
  4262. {
  4263. log.Error("转换失败:" + ex.ToString());
  4264. res.Success = false;
  4265. res.Message = "JSON格式不正确!";
  4266. }
  4267. PurchaseReceiveDoc action = new PurchaseReceiveDoc();
  4268. string resultStr = action.Delete(infos);
  4269. if (resultStr.Length > 0)
  4270. {
  4271. res.Success = true;
  4272. res.Message = "接口调用成功!";
  4273. res.Data = resultStr;
  4274. }
  4275. else
  4276. {
  4277. res.Success = false;
  4278. res.Message = "接口调用失败";
  4279. }
  4280. }
  4281. catch (Exception ex)
  4282. {
  4283. log.Error("调用后台失败:" + ex.ToString());
  4284. res.Success = false;
  4285. res.Message = ex.Message;
  4286. }
  4287. }
  4288. else
  4289. {
  4290. res.Success = false;
  4291. res.Message = "请传入参数";
  4292. }
  4293. }
  4294. catch (Exception ex)
  4295. {
  4296. log.Error("参数检验失败:" + ex.ToString());
  4297. res.Success = false;
  4298. res.Message = ex.Message;
  4299. }
  4300. finally
  4301. {
  4302. str = JsonConvert.SerializeObject(res);
  4303. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4304. }
  4305. log.Debug("删除采购入库单返回值:" + str);
  4306. return result;
  4307. }
  4308. #endregion
  4309. #region 委外采购退货单
  4310. /// <summary>
  4311. /// 获取委外采购退货单
  4312. /// </summary>
  4313. /// <param name="JsonData"></param>
  4314. /// <returns></returns>
  4315. [Route("api/OutsourcingReturnBack/Get")]
  4316. [HttpPost]
  4317. public HttpResponseMessage GETOutsourcingReturnBack([FromBody] object JsonData)
  4318. {
  4319. log.Info("接口:api/OutsourcingReturnBack/Get");
  4320. log.Info("获取委外采购退货单传入值:" + JsonData);
  4321. HttpResponseMessage result = new HttpResponseMessage();
  4322. Result res = new Result();
  4323. string str = string.Empty;
  4324. try
  4325. {
  4326. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4327. {
  4328. try
  4329. {
  4330. List<ICSOutsourcingReturnBack> infos = new List<ICSOutsourcingReturnBack>();
  4331. try
  4332. {
  4333. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReturnBack>>(JsonData.ToString());
  4334. }
  4335. catch (Exception ex)
  4336. {
  4337. log.Error("转换失败:" + ex.ToString());
  4338. res.Success = false;
  4339. res.Message = "JSON格式不正确!";
  4340. }
  4341. OutsourcingReturnBack action = new OutsourcingReturnBack();
  4342. string resultStr = action.Get(infos);
  4343. if (string.IsNullOrWhiteSpace(resultStr))
  4344. {
  4345. res.Success = true;
  4346. res.Message = "接口调用成功!";
  4347. res.Data = resultStr;
  4348. }
  4349. else
  4350. {
  4351. res.Success = false;
  4352. res.Message = resultStr;
  4353. }
  4354. }
  4355. catch (Exception ex)
  4356. {
  4357. log.Error("调用后台失败:" + ex.ToString());
  4358. res.Success = false;
  4359. res.Message = ex.Message;
  4360. }
  4361. }
  4362. else
  4363. {
  4364. res.Success = false;
  4365. res.Message = "请传入参数";
  4366. }
  4367. }
  4368. catch (Exception ex)
  4369. {
  4370. log.Error("参数检验失败:" + ex.ToString());
  4371. res.Success = false;
  4372. res.Message = ex.Message;
  4373. }
  4374. finally
  4375. {
  4376. str = JsonConvert.SerializeObject(res);
  4377. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4378. }
  4379. log.Debug("获取委外采购退货单返回值:" + str);
  4380. return result;
  4381. }
  4382. #endregion
  4383. #region 委外采购入库红字
  4384. /// <summary>
  4385. /// 获取委外采购入库单
  4386. /// </summary>
  4387. /// <param name="JsonData"></param>
  4388. /// <returns></returns>
  4389. [Route("api/OutsourcingReceiveDocNegative/Get")]
  4390. [HttpPost]
  4391. public HttpResponseMessage GetOutsourcingReceiveDocNegative([FromBody] object JsonData)
  4392. {
  4393. log.Info("接口:api/OutsourcingReceiveDocNegative/Get");
  4394. log.Info("获取委外采购入库单传入值:" + JsonData);
  4395. HttpResponseMessage result = new HttpResponseMessage();
  4396. Result res = new Result();
  4397. string str = string.Empty;
  4398. try
  4399. {
  4400. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4401. {
  4402. try
  4403. {
  4404. List<ICSOutsourcingReceiveDocNegative> infos = new List<ICSOutsourcingReceiveDocNegative>();
  4405. try
  4406. {
  4407. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDocNegative>>(JsonData.ToString());
  4408. }
  4409. catch (Exception ex)
  4410. {
  4411. log.Error("转换失败:" + ex.ToString());
  4412. res.Success = false;
  4413. res.Message = "JSON格式不正确!";
  4414. }
  4415. OutsourcingReceiveDocNegative action = new OutsourcingReceiveDocNegative();
  4416. string resultStr = action.Get(infos);
  4417. if (!string.IsNullOrWhiteSpace(resultStr))
  4418. {
  4419. res.Success = true;
  4420. res.Message = "接口调用成功!";
  4421. res.Data = resultStr;
  4422. }
  4423. else
  4424. {
  4425. res.Success = false;
  4426. res.Message = "接口调用失败";
  4427. }
  4428. }
  4429. catch (Exception ex)
  4430. {
  4431. log.Error("调用后台失败:" + ex.ToString());
  4432. res.Success = false;
  4433. res.Message = ex.Message;
  4434. }
  4435. }
  4436. else
  4437. {
  4438. res.Success = false;
  4439. res.Message = "请传入参数";
  4440. }
  4441. }
  4442. catch (Exception ex)
  4443. {
  4444. log.Error("参数检验失败:" + ex.ToString());
  4445. res.Success = false;
  4446. res.Message = ex.Message;
  4447. }
  4448. finally
  4449. {
  4450. str = JsonConvert.SerializeObject(res);
  4451. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4452. }
  4453. log.Debug("获取委外采购入库单返回值:" + str);
  4454. return result;
  4455. }
  4456. /// <summary>
  4457. /// 创建委外采购入库单
  4458. /// </summary>
  4459. /// <param name="JsonData"></param>
  4460. /// <returns></returns>
  4461. [Route("api/OutsourcingReceiveDocNegative/Create")]
  4462. [HttpPost]
  4463. public HttpResponseMessage CreateOutsourcingReceiveDocNegative([FromBody] object JsonData)
  4464. {
  4465. log.Info("接口:api/OutsourcingReceiveDocNegative/Create");
  4466. log.Info("创建委外采购入库单传入值:" + JsonData);
  4467. HttpResponseMessage result = new HttpResponseMessage();
  4468. Result res = new Result();
  4469. string str = string.Empty;
  4470. try
  4471. {
  4472. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4473. {
  4474. try
  4475. {
  4476. List<ICSOutsourcingReceiveDocNegative> infos = new List<ICSOutsourcingReceiveDocNegative>();
  4477. try
  4478. {
  4479. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDocNegative>>(JsonData.ToString());
  4480. }
  4481. catch (Exception ex)
  4482. {
  4483. log.Error("转换失败:" + ex.ToString());
  4484. res.Success = false;
  4485. res.Message = "JSON格式不正确!";
  4486. throw new Exception(res.Message);
  4487. }
  4488. OutsourcingReceiveDocNegative action = new OutsourcingReceiveDocNegative();
  4489. string resultStr = action.CreateOutsourcingReceiveDocNegative(infos);
  4490. if (!string.IsNullOrWhiteSpace(resultStr))
  4491. {
  4492. res.Success = true;
  4493. res.Message = "接口调用成功!";
  4494. res.Data = resultStr;
  4495. }
  4496. else
  4497. {
  4498. res.Success = false;
  4499. res.Data = resultStr;
  4500. }
  4501. }
  4502. catch (Exception ex)
  4503. {
  4504. log.Error("调用后台失败:" + ex.ToString());
  4505. res.Success = false;
  4506. res.Message = ex.Message;
  4507. }
  4508. }
  4509. else
  4510. {
  4511. res.Success = false;
  4512. res.Message = "请传入参数";
  4513. }
  4514. }
  4515. catch (Exception ex)
  4516. {
  4517. log.Error("参数检验失败:" + ex.ToString());
  4518. res.Success = false;
  4519. res.Message = ex.Message;
  4520. }
  4521. finally
  4522. {
  4523. str = JsonConvert.SerializeObject(res);
  4524. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4525. }
  4526. log.Debug("创建委外采购入库单返回值:" + str);
  4527. return result;
  4528. }
  4529. /// <summary>
  4530. /// 审核委外采购入库单
  4531. /// </summary>
  4532. /// <param name="JsonData"></param>
  4533. /// <returns></returns>
  4534. [Route("api/OutsourcingReceiveDocNegative/Approve")]
  4535. [HttpPost]
  4536. public HttpResponseMessage ApproveOutsourcingReceiveDocNegative([FromBody] object JsonData)
  4537. {
  4538. log.Info("接口:api/OutsourcingReceiveDocNegative/Approve");
  4539. log.Info("审核委外采购入库单传入值:" + JsonData);
  4540. HttpResponseMessage result = new HttpResponseMessage();
  4541. Result res = new Result();
  4542. string str = string.Empty;
  4543. try
  4544. {
  4545. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4546. {
  4547. try
  4548. {
  4549. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  4550. try
  4551. {
  4552. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  4553. }
  4554. catch (Exception ex)
  4555. {
  4556. log.Error("转换失败:" + ex.ToString());
  4557. res.Success = false;
  4558. res.Message = "JSON格式不正确!";
  4559. }
  4560. PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
  4561. bool resultStr = action.Approve(infos);
  4562. if (resultStr == true)
  4563. {
  4564. res.Success = true;
  4565. res.Message = "接口调用成功!";
  4566. }
  4567. else
  4568. {
  4569. res.Success = false;
  4570. res.Message = "接口调用失败";
  4571. }
  4572. }
  4573. catch (Exception ex)
  4574. {
  4575. log.Error("调用后台失败:" + ex.ToString());
  4576. res.Success = false;
  4577. res.Message = ex.Message;
  4578. }
  4579. }
  4580. else
  4581. {
  4582. res.Success = false;
  4583. res.Message = "请传入参数";
  4584. }
  4585. }
  4586. catch (Exception ex)
  4587. {
  4588. log.Error("参数检验失败:" + ex.ToString());
  4589. res.Success = false;
  4590. res.Message = ex.Message;
  4591. }
  4592. finally
  4593. {
  4594. str = JsonConvert.SerializeObject(res);
  4595. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4596. }
  4597. log.Debug("审核委外采购入库单返回值:" + str);
  4598. return result;
  4599. }
  4600. /// <summary>
  4601. /// 删除采购入库单
  4602. /// </summary>
  4603. /// <param name="JsonData"></param>
  4604. /// <returns></returns>
  4605. [Route("api/OutsourcingReceiveDocNegative/Delete")]
  4606. [HttpPost]
  4607. public HttpResponseMessage DeleteOutsourcingReceiveDocNegative([FromBody] object JsonData)
  4608. {
  4609. log.Info("接口:api/OutsourcingReceiveDocNegative/Delete");
  4610. log.Info("删除采购入库单传入值:" + JsonData);
  4611. HttpResponseMessage result = new HttpResponseMessage();
  4612. Result res = new Result();
  4613. string str = string.Empty;
  4614. try
  4615. {
  4616. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4617. {
  4618. try
  4619. {
  4620. List<ICSOutsourcingReceiveDocNegative> infos = new List<ICSOutsourcingReceiveDocNegative>();
  4621. try
  4622. {
  4623. infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDocNegative>>(JsonData.ToString());
  4624. }
  4625. catch (Exception ex)
  4626. {
  4627. log.Error("转换失败:" + ex.ToString());
  4628. res.Success = false;
  4629. res.Message = "JSON格式不正确!";
  4630. }
  4631. OutsourcingReceiveDocNegative action = new OutsourcingReceiveDocNegative();
  4632. string resultStr = action.Delete(infos);
  4633. if (string.IsNullOrEmpty(resultStr))
  4634. {
  4635. res.Success = true;
  4636. res.Message = "接口调用成功!";
  4637. }
  4638. else
  4639. {
  4640. res.Success = false;
  4641. res.Message = "接口调用失败";
  4642. }
  4643. }
  4644. catch (Exception ex)
  4645. {
  4646. log.Error("调用后台失败:" + ex.ToString());
  4647. res.Success = false;
  4648. res.Message = ex.Message;
  4649. }
  4650. }
  4651. else
  4652. {
  4653. res.Success = false;
  4654. res.Message = "请传入参数";
  4655. }
  4656. }
  4657. catch (Exception ex)
  4658. {
  4659. log.Error("参数检验失败:" + ex.ToString());
  4660. res.Success = false;
  4661. res.Message = ex.Message;
  4662. }
  4663. finally
  4664. {
  4665. str = JsonConvert.SerializeObject(res);
  4666. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4667. }
  4668. log.Debug("删除采购入库单返回值:" + str);
  4669. return result;
  4670. }
  4671. #endregion
  4672. #region 成品入库单
  4673. /// <summary>
  4674. /// 获取成品入库单
  4675. /// </summary>
  4676. /// <param name="JsonData"></param>
  4677. /// <returns></returns>
  4678. [Route("api/ManufactureReceiveDoc/Get")]
  4679. [HttpPost]
  4680. public HttpResponseMessage GetManufactureReceiveDoc([FromBody] object JsonData)
  4681. {
  4682. log.Info("接口:api/ManufactureReceiveDoc/Get");
  4683. log.Info("获取成品入库单传入值:" + JsonData);
  4684. HttpResponseMessage result = new HttpResponseMessage();
  4685. Result res = new Result();
  4686. string str = string.Empty;
  4687. try
  4688. {
  4689. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4690. {
  4691. try
  4692. {
  4693. List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
  4694. try
  4695. {
  4696. infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
  4697. }
  4698. catch (Exception ex)
  4699. {
  4700. log.Error("转换失败:" + ex.ToString());
  4701. res.Success = false;
  4702. res.Message = "JSON格式不正确!";
  4703. }
  4704. ManufactureReceiveDoc action = new ManufactureReceiveDoc();
  4705. string resultStr = action.Get(infos);
  4706. if (!string.IsNullOrWhiteSpace(resultStr))
  4707. {
  4708. res.Success = true;
  4709. res.Message = "接口调用成功!";
  4710. res.Data = resultStr;
  4711. }
  4712. else
  4713. {
  4714. res.Success = false;
  4715. res.Message = resultStr;
  4716. }
  4717. }
  4718. catch (Exception ex)
  4719. {
  4720. log.Error("调用后台失败:" + ex.ToString());
  4721. res.Success = false;
  4722. res.Message = ex.Message;
  4723. }
  4724. }
  4725. else
  4726. {
  4727. res.Success = false;
  4728. res.Message = "请传入参数";
  4729. }
  4730. }
  4731. catch (Exception ex)
  4732. {
  4733. log.Error("参数检验失败:" + ex.ToString());
  4734. res.Success = false;
  4735. res.Message = ex.Message;
  4736. }
  4737. finally
  4738. {
  4739. str = JsonConvert.SerializeObject(res);
  4740. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4741. }
  4742. log.Debug("获取成品入库单返回值:" + str);
  4743. return result;
  4744. }
  4745. ///// <summary>
  4746. ///// 创建成品入库单
  4747. ///// </summary>
  4748. ///// <param name="JsonData"></param>
  4749. ///// <returns></returns>
  4750. //[Route("api/ManufactureReceiveDoc/Create")]
  4751. //[HttpPost]
  4752. //public HttpResponseMessage CreateManufactureReceiveDoc([FromBody] object JsonData)
  4753. //{
  4754. // log.Info("接口:api/ManufactureReceiveDoc/Create");
  4755. // log.Info("创建成品入库单传入值:" + JsonData);
  4756. // HttpResponseMessage result = new HttpResponseMessage();
  4757. // Result res = new Result();
  4758. // string str = string.Empty;
  4759. // try
  4760. // {
  4761. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4762. // {
  4763. // try
  4764. // {
  4765. // List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
  4766. // try
  4767. // {
  4768. // infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
  4769. // }
  4770. // catch (Exception ex)
  4771. // {
  4772. // log.Error("转换失败:" + ex.ToString());
  4773. // res.Success = false;
  4774. // res.Message = "JSON格式不正确!";
  4775. // }
  4776. // ManufactureReceiveDoc action = new ManufactureReceiveDoc();
  4777. // string resultStr = action.CreateManufactureReceiveDoc(infos);
  4778. // if (!string.IsNullOrWhiteSpace(resultStr))
  4779. // {
  4780. // res.Success = true;
  4781. // res.Message = "接口调用成功!";
  4782. // res.Data = resultStr;
  4783. // }
  4784. // else
  4785. // {
  4786. // res.Success = false;
  4787. // res.Message = resultStr;
  4788. // }
  4789. // }
  4790. // catch (Exception ex)
  4791. // {
  4792. // log.Error("调用后台失败:" + ex.ToString());
  4793. // res.Success = false;
  4794. // res.Message = ex.Message;
  4795. // }
  4796. // }
  4797. // else
  4798. // {
  4799. // res.Success = false;
  4800. // res.Message = "请传入参数";
  4801. // }
  4802. // }
  4803. // catch (Exception ex)
  4804. // {
  4805. // log.Error("参数检验失败:" + ex.ToString());
  4806. // res.Success = false;
  4807. // res.Message = ex.Message;
  4808. // }
  4809. // finally
  4810. // {
  4811. // str = JsonConvert.SerializeObject(res);
  4812. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4813. // }
  4814. // log.Debug("创建成品入库单返回值:" + str);
  4815. // return result;
  4816. //}
  4817. /// <summary>
  4818. /// 连副产品入库
  4819. /// </summary>
  4820. /// <param name="JsonData"></param>
  4821. /// <returns></returns>
  4822. [Route("api/ManufactureLFReceiveDoc/Create")]
  4823. [HttpPost]
  4824. public HttpResponseMessage CreateManufactureLFReceiveDoc([FromBody] object JsonData)
  4825. {
  4826. log.Info("接口:api/ManufactureLFReceiveDoc/Create");
  4827. log.Info("创建连副产品入库单传入值:" + JsonData);
  4828. HttpResponseMessage result = new HttpResponseMessage();
  4829. Result res = new Result();
  4830. string str = string.Empty;
  4831. try
  4832. {
  4833. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4834. {
  4835. try
  4836. {
  4837. List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
  4838. try
  4839. {
  4840. infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
  4841. }
  4842. catch (Exception ex)
  4843. {
  4844. log.Error("转换失败:" + ex.ToString());
  4845. res.Success = false;
  4846. res.Message = "JSON格式不正确!";
  4847. }
  4848. ManufactureReceiveDoc action = new ManufactureReceiveDoc();
  4849. string resultStr = action.CreateManufactureReceiveDoc1(infos);
  4850. if (!string.IsNullOrWhiteSpace(resultStr))
  4851. {
  4852. res.Success = true;
  4853. res.Message = "接口调用成功!";
  4854. res.Data = resultStr;
  4855. }
  4856. else
  4857. {
  4858. res.Success = false;
  4859. res.Message = resultStr;
  4860. }
  4861. }
  4862. catch (Exception ex)
  4863. {
  4864. log.Error("调用后台失败:" + ex.ToString());
  4865. res.Success = false;
  4866. res.Message = ex.Message;
  4867. }
  4868. }
  4869. else
  4870. {
  4871. res.Success = false;
  4872. res.Message = "请传入参数";
  4873. }
  4874. }
  4875. catch (Exception ex)
  4876. {
  4877. log.Error("参数检验失败:" + ex.ToString());
  4878. res.Success = false;
  4879. res.Message = ex.Message;
  4880. }
  4881. finally
  4882. {
  4883. str = JsonConvert.SerializeObject(res);
  4884. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4885. }
  4886. log.Debug("创建连副产品入库单返回值:" + str);
  4887. return result;
  4888. }
  4889. /// <summary>
  4890. /// 审核委外退料单
  4891. /// </summary>
  4892. /// <param name="JsonData"></param>
  4893. /// <returns></returns>
  4894. [Route("api/ManufactureReceiveDoc/Approve")]
  4895. [HttpPost]
  4896. public HttpResponseMessage ApproveManufactureReceiveDoc([FromBody] object JsonData)
  4897. {
  4898. log.Info("接口:api/ManufactureReceiveDoc/Approve");
  4899. log.Info("审核委外退料单传入值:" + JsonData);
  4900. HttpResponseMessage result = new HttpResponseMessage();
  4901. Result res = new Result();
  4902. string str = string.Empty;
  4903. try
  4904. {
  4905. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4906. {
  4907. try
  4908. {
  4909. List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
  4910. try
  4911. {
  4912. infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
  4913. }
  4914. catch (Exception ex)
  4915. {
  4916. log.Error("转换失败:" + ex.ToString());
  4917. res.Success = false;
  4918. res.Message = "JSON格式不正确!";
  4919. }
  4920. ManufactureReceiveDoc action = new ManufactureReceiveDoc();
  4921. bool resultStr = action.Approve(infos);
  4922. if (resultStr == false)
  4923. {
  4924. res.Success = false;
  4925. res.Message = "接口调用失败!";
  4926. }
  4927. else
  4928. {
  4929. res.Success = true;
  4930. res.Message = "接口调用成功!";
  4931. }
  4932. }
  4933. catch (Exception ex)
  4934. {
  4935. log.Error("调用后台失败:" + ex.ToString());
  4936. res.Success = false;
  4937. res.Message = ex.Message;
  4938. }
  4939. }
  4940. else
  4941. {
  4942. res.Success = false;
  4943. res.Message = "请传入参数";
  4944. }
  4945. }
  4946. catch (Exception ex)
  4947. {
  4948. log.Error("参数检验失败:" + ex.ToString());
  4949. res.Success = false;
  4950. res.Message = ex.Message;
  4951. }
  4952. finally
  4953. {
  4954. str = JsonConvert.SerializeObject(res);
  4955. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  4956. }
  4957. log.Debug("审核委外退料单返回值:" + str);
  4958. return result;
  4959. }
  4960. /// <summary>
  4961. /// 删除委外退料单
  4962. /// </summary>
  4963. /// <param name="JsonData"></param>
  4964. /// <returns></returns>
  4965. [Route("api/ManufactureReceiveDoc/Delete")]
  4966. [HttpPost]
  4967. public HttpResponseMessage DeleteManufactureReceiveDoc([FromBody] object JsonData)
  4968. {
  4969. log.Info("接口:api/ManufactureReceiveDoc/Delete");
  4970. log.Info("删除委外退料单传入值:" + JsonData);
  4971. HttpResponseMessage result = new HttpResponseMessage();
  4972. Result res = new Result();
  4973. string str = string.Empty;
  4974. try
  4975. {
  4976. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  4977. {
  4978. try
  4979. {
  4980. List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
  4981. try
  4982. {
  4983. infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
  4984. }
  4985. catch (Exception ex)
  4986. {
  4987. log.Error("转换失败:" + ex.ToString());
  4988. res.Success = false;
  4989. res.Message = "JSON格式不正确!";
  4990. }
  4991. ManufactureReceiveDoc action = new ManufactureReceiveDoc();
  4992. string resultStr = action.Delete(infos);
  4993. if (string.IsNullOrWhiteSpace(resultStr))
  4994. {
  4995. res.Success = true;
  4996. res.Message = "接口调用成功!";
  4997. }
  4998. else
  4999. {
  5000. res.Success = false;
  5001. res.Message = resultStr;
  5002. }
  5003. }
  5004. catch (Exception ex)
  5005. {
  5006. log.Error("调用后台失败:" + ex.ToString());
  5007. res.Success = false;
  5008. res.Message = ex.Message;
  5009. }
  5010. }
  5011. else
  5012. {
  5013. res.Success = false;
  5014. res.Message = "请传入参数";
  5015. }
  5016. }
  5017. catch (Exception ex)
  5018. {
  5019. log.Error("参数检验失败:" + ex.ToString());
  5020. res.Success = false;
  5021. res.Message = ex.Message;
  5022. }
  5023. finally
  5024. {
  5025. str = JsonConvert.SerializeObject(res);
  5026. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5027. }
  5028. log.Debug("删除委外退料单返回值:" + str);
  5029. return result;
  5030. }
  5031. #endregion
  5032. #region 销售出库
  5033. /// <summary>
  5034. /// 获取销售出库单
  5035. /// </summary>
  5036. /// <param name="JsonData"></param>
  5037. /// <returns></returns>
  5038. [Route("api/SalesShipmentDoc/Get")]
  5039. [HttpPost]
  5040. public HttpResponseMessage GetSalesShipmentDoc([FromBody] object JsonData)
  5041. {
  5042. log.Info("接口:api/SalesShipmentDoc/Get");
  5043. log.Info("获取销售出库单传入值:" + JsonData);
  5044. HttpResponseMessage result = new HttpResponseMessage();
  5045. Result res = new Result();
  5046. string str = string.Empty;
  5047. try
  5048. {
  5049. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5050. {
  5051. try
  5052. {
  5053. List<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>();
  5054. try
  5055. {
  5056. infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(JsonData.ToString());
  5057. }
  5058. catch (Exception ex)
  5059. {
  5060. log.Error("转换失败:" + ex.ToString());
  5061. res.Success = false;
  5062. res.Message = "JSON格式不正确!";
  5063. }
  5064. SalesShipmentDoc action = new SalesShipmentDoc();
  5065. string resultStr = action.Get(infos);
  5066. if (!string.IsNullOrWhiteSpace(resultStr))
  5067. {
  5068. res.Success = true;
  5069. res.Message = "接口调用成功!";
  5070. res.Data = resultStr;
  5071. }
  5072. else
  5073. {
  5074. res.Success = false;
  5075. res.Message = resultStr;
  5076. }
  5077. }
  5078. catch (Exception ex)
  5079. {
  5080. log.Error("调用后台失败:" + ex.ToString());
  5081. res.Success = false;
  5082. res.Message = ex.Message;
  5083. }
  5084. }
  5085. else
  5086. {
  5087. res.Success = false;
  5088. res.Message = "请传入参数";
  5089. }
  5090. }
  5091. catch (Exception ex)
  5092. {
  5093. log.Error("参数检验失败:" + ex.ToString());
  5094. res.Success = false;
  5095. res.Message = ex.Message;
  5096. }
  5097. finally
  5098. {
  5099. str = JsonConvert.SerializeObject(res);
  5100. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5101. }
  5102. log.Debug("获取销售出库单返回值:" + str);
  5103. return result;
  5104. }
  5105. ///// <summary>
  5106. ///// 创建销售出库单
  5107. ///// </summary>
  5108. ///// <param name="JsonData"></param>
  5109. ///// <returns></returns>
  5110. //[Route("api/SalesShipmentDoc/Create")]
  5111. //[HttpPost]
  5112. //public HttpResponseMessage CreateSalesShipmentDoc([FromBody] object JsonData)
  5113. //{
  5114. // log.Info("接口:api/SalesShipmentDoc/Create");
  5115. // log.Info("创建销售出库单传入值:" + JsonData);
  5116. // HttpResponseMessage result = new HttpResponseMessage();
  5117. // Result res = new Result();
  5118. // string str = string.Empty;
  5119. // try
  5120. // {
  5121. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5122. // {
  5123. // try
  5124. // {
  5125. // List<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>();
  5126. // try
  5127. // {
  5128. // infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(JsonData.ToString());
  5129. // }
  5130. // catch (Exception ex)
  5131. // {
  5132. // log.Error("转换失败:" + ex.ToString());
  5133. // res.Success = false;
  5134. // res.Message = "JSON格式不正确!";
  5135. // }
  5136. // SalesShipmentDoc action = new SalesShipmentDoc();
  5137. // string resultStr = action.CreateSalesShipmentDoc(infos);
  5138. // if (!string.IsNullOrWhiteSpace(resultStr))
  5139. // {
  5140. // res.Success = true;
  5141. // res.Message = "接口调用成功!";
  5142. // res.Data = resultStr;
  5143. // }
  5144. // else
  5145. // {
  5146. // res.Success = false;
  5147. // res.Message = resultStr;
  5148. // }
  5149. // }
  5150. // catch (Exception ex)
  5151. // {
  5152. // log.Error("调用后台失败:" + ex.ToString());
  5153. // res.Success = false;
  5154. // res.Message = ex.Message;
  5155. // }
  5156. // }
  5157. // else
  5158. // {
  5159. // res.Success = false;
  5160. // res.Message = "请传入参数";
  5161. // }
  5162. // }
  5163. // catch (Exception ex)
  5164. // {
  5165. // log.Error("参数检验失败:" + ex.ToString());
  5166. // res.Success = false;
  5167. // res.Message = ex.Message;
  5168. // }
  5169. // finally
  5170. // {
  5171. // str = JsonConvert.SerializeObject(res);
  5172. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5173. // }
  5174. // log.Debug("创建销售出库单返回值:" + str);
  5175. // return result;
  5176. //}
  5177. /// <summary>
  5178. /// 审核销售出库单
  5179. /// </summary>
  5180. /// <param name="JsonData"></param>
  5181. /// <returns></returns>
  5182. [Route("api/SalesShipmentDoc/Approve")]
  5183. [HttpPost]
  5184. public HttpResponseMessage ApproveSalesShipmentDoc([FromBody] object JsonData)
  5185. {
  5186. log.Info("接口:api/SalesShipmentDoc/Approve");
  5187. log.Info("审核销售出库单传入值:" + JsonData);
  5188. HttpResponseMessage result = new HttpResponseMessage();
  5189. Result res = new Result();
  5190. string str = string.Empty;
  5191. try
  5192. {
  5193. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5194. {
  5195. try
  5196. {
  5197. List<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>();
  5198. try
  5199. {
  5200. infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(JsonData.ToString());
  5201. }
  5202. catch (Exception ex)
  5203. {
  5204. log.Error("转换失败:" + ex.ToString());
  5205. res.Success = false;
  5206. res.Message = "JSON格式不正确!";
  5207. }
  5208. SalesShipmentDoc action = new SalesShipmentDoc();
  5209. string resultStr = action.Approve(infos);
  5210. if (string.IsNullOrWhiteSpace(resultStr))
  5211. {
  5212. res.Success = true;
  5213. res.Message = "接口调用成功!";
  5214. }
  5215. else
  5216. {
  5217. res.Success = false;
  5218. res.Message = resultStr;
  5219. }
  5220. }
  5221. catch (Exception ex)
  5222. {
  5223. log.Error("调用后台失败:" + ex.ToString());
  5224. res.Success = false;
  5225. res.Message = ex.Message;
  5226. }
  5227. }
  5228. else
  5229. {
  5230. res.Success = false;
  5231. res.Message = "请传入参数";
  5232. }
  5233. }
  5234. catch (Exception ex)
  5235. {
  5236. log.Error("参数检验失败:" + ex.ToString());
  5237. res.Success = false;
  5238. res.Message = ex.Message;
  5239. }
  5240. finally
  5241. {
  5242. str = JsonConvert.SerializeObject(res);
  5243. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5244. }
  5245. log.Debug("审核销售出库单返回值:" + str);
  5246. return result;
  5247. }
  5248. /// <summary>
  5249. /// 删除销售出库单
  5250. /// </summary>
  5251. /// <param name="JsonData"></param>
  5252. /// <returns></returns>
  5253. [Route("api/SalesShipmentDoc/Delete")]
  5254. [HttpPost]
  5255. public HttpResponseMessage DeleteSalesShipmentDoc([FromBody] object JsonData)
  5256. {
  5257. log.Info("接口:api/SalesShipmentDoc/Delete");
  5258. log.Info("删除销售出库单传入值:" + JsonData);
  5259. HttpResponseMessage result = new HttpResponseMessage();
  5260. Result res = new Result();
  5261. string str = string.Empty;
  5262. try
  5263. {
  5264. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5265. {
  5266. try
  5267. {
  5268. List<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>();
  5269. try
  5270. {
  5271. infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(JsonData.ToString());
  5272. }
  5273. catch (Exception ex)
  5274. {
  5275. log.Error("转换失败:" + ex.ToString());
  5276. res.Success = false;
  5277. res.Message = "JSON格式不正确!";
  5278. }
  5279. SalesShipmentDoc action = new SalesShipmentDoc();
  5280. string resultStr = action.Delete(infos);
  5281. if (string.IsNullOrWhiteSpace(resultStr))
  5282. {
  5283. res.Success = true;
  5284. res.Message = "接口调用成功!";
  5285. }
  5286. else
  5287. {
  5288. res.Success = false;
  5289. res.Message = resultStr;
  5290. }
  5291. }
  5292. catch (Exception ex)
  5293. {
  5294. log.Error("调用后台失败:" + ex.ToString());
  5295. res.Success = false;
  5296. res.Message = ex.Message;
  5297. }
  5298. }
  5299. else
  5300. {
  5301. res.Success = false;
  5302. res.Message = "请传入参数";
  5303. }
  5304. }
  5305. catch (Exception ex)
  5306. {
  5307. log.Error("参数检验失败:" + ex.ToString());
  5308. res.Success = false;
  5309. res.Message = ex.Message;
  5310. }
  5311. finally
  5312. {
  5313. str = JsonConvert.SerializeObject(res);
  5314. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5315. }
  5316. log.Debug("删除销售出库单返回值:" + str);
  5317. return result;
  5318. }
  5319. #endregion
  5320. #region 销售出库红字
  5321. /// <summary>
  5322. /// 获取销售出库单红字
  5323. /// </summary>
  5324. /// <param name="JsonData"></param>
  5325. /// <returns></returns>
  5326. [Route("api/SalesShipmentDocNegative/Get")]
  5327. [HttpPost]
  5328. public HttpResponseMessage GetSalesShipmentDocNegative([FromBody] object JsonData)
  5329. {
  5330. log.Info("接口:api/SalesShipmentDocNegative/Get");
  5331. log.Info("获取销售出库单红字传入值:" + JsonData);
  5332. HttpResponseMessage result = new HttpResponseMessage();
  5333. Result res = new Result();
  5334. string str = string.Empty;
  5335. try
  5336. {
  5337. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5338. {
  5339. try
  5340. {
  5341. List<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>();
  5342. try
  5343. {
  5344. infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(JsonData.ToString());
  5345. }
  5346. catch (Exception ex)
  5347. {
  5348. log.Error("转换失败:" + ex.ToString());
  5349. res.Success = false;
  5350. res.Message = "JSON格式不正确!";
  5351. }
  5352. SalesShipmentDocNegative action = new SalesShipmentDocNegative();
  5353. string resultStr = action.Get(infos);
  5354. if (!string.IsNullOrWhiteSpace(resultStr))
  5355. {
  5356. res.Success = true;
  5357. res.Message = "接口调用成功!";
  5358. res.Data = resultStr;
  5359. }
  5360. else
  5361. {
  5362. res.Success = false;
  5363. res.Message = resultStr;
  5364. }
  5365. }
  5366. catch (Exception ex)
  5367. {
  5368. log.Error("调用后台失败:" + ex.ToString());
  5369. res.Success = false;
  5370. res.Message = ex.Message;
  5371. }
  5372. }
  5373. else
  5374. {
  5375. res.Success = false;
  5376. res.Message = "请传入参数";
  5377. }
  5378. }
  5379. catch (Exception ex)
  5380. {
  5381. log.Error("参数检验失败:" + ex.ToString());
  5382. res.Success = false;
  5383. res.Message = ex.Message;
  5384. }
  5385. finally
  5386. {
  5387. str = JsonConvert.SerializeObject(res);
  5388. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5389. }
  5390. log.Debug("获取销售出库单红字返回值:" + str);
  5391. return result;
  5392. }
  5393. ///// <summary>
  5394. ///// 创建销售出库单
  5395. ///// </summary>
  5396. ///// <param name="JsonData"></param>
  5397. ///// <returns></returns>
  5398. //[Route("api/SalesShipmentDocNegative/Create")]
  5399. //[HttpPost]
  5400. //public HttpResponseMessage CreateSalesShipmentDocNegative([FromBody] object JsonData)
  5401. //{
  5402. // log.Info("接口:api/SalesShipmentDocNegative/Create,");
  5403. // log.Info("创建销售出库单传入值:" + JsonData);
  5404. // HttpResponseMessage result = new HttpResponseMessage();
  5405. // Result res = new Result();
  5406. // string str = string.Empty;
  5407. // try
  5408. // {
  5409. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5410. // {
  5411. // try
  5412. // {
  5413. // List<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>();
  5414. // try
  5415. // {
  5416. // infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(JsonData.ToString());
  5417. // }
  5418. // catch (Exception ex)
  5419. // {
  5420. // log.Error("转换失败:" + ex.ToString());
  5421. // res.Success = false;
  5422. // res.Message = "JSON格式不正确!";
  5423. // }
  5424. // SalesShipmentDocNegative action = new SalesShipmentDocNegative();
  5425. // string resultStr = action.CreateSalesShipmentDocNegative(infos);
  5426. // if (!string.IsNullOrWhiteSpace(resultStr))
  5427. // {
  5428. // res.Success = true;
  5429. // res.Message = "接口调用成功!";
  5430. // res.Data = resultStr;
  5431. // }
  5432. // else
  5433. // {
  5434. // res.Success = false;
  5435. // res.Message = resultStr;
  5436. // }
  5437. // }
  5438. // catch (Exception ex)
  5439. // {
  5440. // log.Error("调用后台失败:" + ex.ToString());
  5441. // res.Success = false;
  5442. // res.Message = ex.Message;
  5443. // }
  5444. // }
  5445. // else
  5446. // {
  5447. // res.Success = false;
  5448. // res.Message = "请传入参数";
  5449. // }
  5450. // }
  5451. // catch (Exception ex)
  5452. // {
  5453. // log.Error("参数检验失败:" + ex.ToString());
  5454. // res.Success = false;
  5455. // res.Message = ex.Message;
  5456. // }
  5457. // finally
  5458. // {
  5459. // str = JsonConvert.SerializeObject(res);
  5460. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5461. // }
  5462. // log.Debug("创建销售出库单返回值:" + str);
  5463. // return result;
  5464. //}
  5465. /// <summary>
  5466. /// 审核销售出库单红字
  5467. /// </summary>
  5468. /// <param name="JsonData"></param>
  5469. /// <returns></returns>
  5470. [Route("api/SalesShipmentDocNegative/Approve")]
  5471. [HttpPost]
  5472. public HttpResponseMessage ApproveSalesShipmentDocNegative([FromBody] object JsonData)
  5473. {
  5474. log.Info("接口:api/SalesShipmentDocNegative/Approve");
  5475. log.Info("审核销售出库单红字传入值:" + JsonData);
  5476. HttpResponseMessage result = new HttpResponseMessage();
  5477. Result res = new Result();
  5478. string str = string.Empty;
  5479. try
  5480. {
  5481. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5482. {
  5483. try
  5484. {
  5485. List<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>();
  5486. try
  5487. {
  5488. infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(JsonData.ToString());
  5489. }
  5490. catch (Exception ex)
  5491. {
  5492. log.Error("转换失败:" + ex.ToString());
  5493. res.Success = false;
  5494. res.Message = "JSON格式不正确!";
  5495. }
  5496. SalesShipmentDocNegative action = new SalesShipmentDocNegative();
  5497. string resultStr = action.Approve(infos);
  5498. if (string.IsNullOrWhiteSpace(resultStr))
  5499. {
  5500. res.Success = true;
  5501. res.Message = "接口调用成功!";
  5502. }
  5503. else
  5504. {
  5505. res.Success = false;
  5506. res.Message = resultStr;
  5507. }
  5508. }
  5509. catch (Exception ex)
  5510. {
  5511. log.Error("调用后台失败:" + ex.ToString());
  5512. res.Success = false;
  5513. res.Message = ex.Message;
  5514. }
  5515. }
  5516. else
  5517. {
  5518. res.Success = false;
  5519. res.Message = "请传入参数";
  5520. }
  5521. }
  5522. catch (Exception ex)
  5523. {
  5524. log.Error("参数检验失败:" + ex.ToString());
  5525. res.Success = false;
  5526. res.Message = ex.Message;
  5527. }
  5528. finally
  5529. {
  5530. str = JsonConvert.SerializeObject(res);
  5531. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5532. }
  5533. log.Debug("审核销售出库单红字返回值:" + str);
  5534. return result;
  5535. }
  5536. /// <summary>
  5537. /// 删除销售出库单红字
  5538. /// </summary>
  5539. /// <param name="JsonData"></param>
  5540. /// <returns></returns>
  5541. [Route("api/SalesShipmentDocNegative/Delete")]
  5542. [HttpPost]
  5543. public HttpResponseMessage DeleteSalesShipmentDocNegative([FromBody] object JsonData)
  5544. {
  5545. log.Info("接口:api/SalesShipmentDocNegative/Delete");
  5546. log.Info("删除销售出库单红字传入值:" + JsonData);
  5547. HttpResponseMessage result = new HttpResponseMessage();
  5548. Result res = new Result();
  5549. string str = string.Empty;
  5550. try
  5551. {
  5552. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5553. {
  5554. try
  5555. {
  5556. List<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>();
  5557. try
  5558. {
  5559. infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(JsonData.ToString());
  5560. }
  5561. catch (Exception ex)
  5562. {
  5563. log.Error("转换失败:" + ex.ToString());
  5564. res.Success = false;
  5565. res.Message = "JSON格式不正确!";
  5566. }
  5567. SalesShipmentDocNegative action = new SalesShipmentDocNegative();
  5568. string resultStr = action.Delete(infos);
  5569. if (string.IsNullOrWhiteSpace(resultStr))
  5570. {
  5571. res.Success = true;
  5572. res.Message = "接口调用成功!";
  5573. }
  5574. else
  5575. {
  5576. res.Success = false;
  5577. res.Message = resultStr;
  5578. }
  5579. }
  5580. catch (Exception ex)
  5581. {
  5582. log.Error("调用后台失败:" + ex.ToString());
  5583. res.Success = false;
  5584. res.Message = ex.Message;
  5585. }
  5586. }
  5587. else
  5588. {
  5589. res.Success = false;
  5590. res.Message = "请传入参数";
  5591. }
  5592. }
  5593. catch (Exception ex)
  5594. {
  5595. log.Error("参数检验失败:" + ex.ToString());
  5596. res.Success = false;
  5597. res.Message = ex.Message;
  5598. }
  5599. finally
  5600. {
  5601. str = JsonConvert.SerializeObject(res);
  5602. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5603. }
  5604. log.Debug("删除销售出库单红字返回值:" + str);
  5605. return result;
  5606. }
  5607. #endregion
  5608. #region 销售订单
  5609. /// <summary>
  5610. /// 获取销售订单
  5611. /// </summary>
  5612. /// <param name="JsonData"></param>
  5613. /// <returns></returns>
  5614. [Route("api/SalesOrder/Get")]
  5615. [HttpPost]
  5616. public HttpResponseMessage GetSalesOrder([FromBody] object JsonData)
  5617. {
  5618. log.Info("接口:api/SalesOrder/Get");
  5619. log.Info("获取销售订单传入值:" + JsonData);
  5620. HttpResponseMessage result = new HttpResponseMessage();
  5621. Result res = new Result();
  5622. string str = string.Empty;
  5623. try
  5624. {
  5625. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5626. {
  5627. try
  5628. {
  5629. List<ICSSalesOrder> infos = new List<ICSSalesOrder>();
  5630. try
  5631. {
  5632. infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(JsonData.ToString());
  5633. }
  5634. catch (Exception ex)
  5635. {
  5636. log.Error("转换失败:" + ex.ToString());
  5637. res.Success = false;
  5638. res.Message = "JSON格式不正确!";
  5639. }
  5640. SalesOrder action = new SalesOrder();
  5641. string resultStr = action.Get(infos);
  5642. if (!string.IsNullOrWhiteSpace(resultStr))
  5643. {
  5644. res.Success = true;
  5645. res.Message = "接口调用成功!";
  5646. res.Data = resultStr;
  5647. }
  5648. else
  5649. {
  5650. res.Success = false;
  5651. res.Message = resultStr;
  5652. }
  5653. }
  5654. catch (Exception ex)
  5655. {
  5656. log.Error("调用后台失败:" + ex.ToString());
  5657. res.Success = false;
  5658. res.Message = ex.Message;
  5659. }
  5660. }
  5661. else
  5662. {
  5663. res.Success = false;
  5664. res.Message = "请传入参数";
  5665. }
  5666. }
  5667. catch (Exception ex)
  5668. {
  5669. log.Error("参数检验失败:" + ex.ToString());
  5670. res.Success = false;
  5671. res.Message = ex.Message;
  5672. }
  5673. finally
  5674. {
  5675. str = JsonConvert.SerializeObject(res);
  5676. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5677. }
  5678. log.Debug("获取销售订单返回值:" + str);
  5679. return result;
  5680. }
  5681. /// <summary>
  5682. /// 创建销售订单
  5683. /// </summary>
  5684. /// <param name="JsonData"></param>
  5685. /// <returns></returns>
  5686. [Route("api/SalesOrder/Create")]
  5687. [HttpPost]
  5688. public HttpResponseMessage CreateSalesOrder([FromBody] object JsonData)
  5689. {
  5690. log.Info("接口:api/SalesOrder/Create");
  5691. log.Info("创建销售订单传入值:" + JsonData);
  5692. HttpResponseMessage result = new HttpResponseMessage();
  5693. Result res = new Result();
  5694. string str = string.Empty;
  5695. try
  5696. {
  5697. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5698. {
  5699. try
  5700. {
  5701. List<ICSSalesOrder> infos = new List<ICSSalesOrder>();
  5702. try
  5703. {
  5704. infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(JsonData.ToString());
  5705. }
  5706. catch (Exception ex)
  5707. {
  5708. log.Error("转换失败:" + ex.ToString());
  5709. res.Success = false;
  5710. res.Message = "JSON格式不正确!";
  5711. }
  5712. SalesOrder action = new SalesOrder();
  5713. string resultStr = action.CerateSalesOrder(infos);
  5714. if (!string.IsNullOrWhiteSpace(resultStr))
  5715. {
  5716. res.Success = true;
  5717. res.Message = "接口调用成功!";
  5718. res.Data = resultStr;
  5719. }
  5720. else
  5721. {
  5722. res.Success = false;
  5723. res.Message = resultStr;
  5724. }
  5725. }
  5726. catch (Exception ex)
  5727. {
  5728. log.Error("调用后台失败:" + ex.ToString());
  5729. res.Success = false;
  5730. res.Message = ex.Message;
  5731. }
  5732. }
  5733. else
  5734. {
  5735. res.Success = false;
  5736. res.Message = "请传入参数";
  5737. }
  5738. }
  5739. catch (Exception ex)
  5740. {
  5741. log.Error("参数检验失败:" + ex.ToString());
  5742. res.Success = false;
  5743. res.Message = ex.Message;
  5744. }
  5745. finally
  5746. {
  5747. str = JsonConvert.SerializeObject(res);
  5748. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5749. }
  5750. log.Debug("创建销售订单返回值:" + str);
  5751. return result;
  5752. }
  5753. /// <summary>
  5754. /// 审核销售订单
  5755. /// </summary>
  5756. /// <param name="JsonData"></param>
  5757. /// <returns></returns>
  5758. [Route("api/SalesOrder/Approve")]
  5759. [HttpPost]
  5760. public HttpResponseMessage ApproveSalesOrder([FromBody] object JsonData)
  5761. {
  5762. log.Info("接口:api/SalesOrder/Approve");
  5763. log.Info("审核销售订单传入值:" + JsonData);
  5764. HttpResponseMessage result = new HttpResponseMessage();
  5765. Result res = new Result();
  5766. string str = string.Empty;
  5767. try
  5768. {
  5769. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5770. {
  5771. try
  5772. {
  5773. List<ICSSalesOrder> infos = new List<ICSSalesOrder>();
  5774. try
  5775. {
  5776. infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(JsonData.ToString());
  5777. }
  5778. catch (Exception ex)
  5779. {
  5780. log.Error("转换失败:" + ex.ToString());
  5781. res.Success = false;
  5782. res.Message = "JSON格式不正确!";
  5783. }
  5784. SalesOrder action = new SalesOrder();
  5785. string resultStr = action.Approve(infos);
  5786. if (string.IsNullOrWhiteSpace(resultStr))
  5787. {
  5788. res.Success = true;
  5789. res.Message = "接口调用成功!";
  5790. }
  5791. else
  5792. {
  5793. res.Success = false;
  5794. res.Message = resultStr;
  5795. }
  5796. }
  5797. catch (Exception ex)
  5798. {
  5799. log.Error("调用后台失败:" + ex.ToString());
  5800. res.Success = false;
  5801. res.Message = ex.Message;
  5802. }
  5803. }
  5804. else
  5805. {
  5806. res.Success = false;
  5807. res.Message = "请传入参数";
  5808. }
  5809. }
  5810. catch (Exception ex)
  5811. {
  5812. log.Error("参数检验失败:" + ex.ToString());
  5813. res.Success = false;
  5814. res.Message = ex.Message;
  5815. }
  5816. finally
  5817. {
  5818. str = JsonConvert.SerializeObject(res);
  5819. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5820. }
  5821. log.Debug("审核销售订单返回值:" + str);
  5822. return result;
  5823. }
  5824. /// <summary>
  5825. /// 删除销售订单
  5826. /// </summary>
  5827. /// <param name="JsonData"></param>
  5828. /// <returns></returns>
  5829. [Route("api/SalesOrder/Delete")]
  5830. [HttpPost]
  5831. public HttpResponseMessage DeleteSalesOrder([FromBody] object JsonData)
  5832. {
  5833. log.Info("接口:api/SalesOrder/Delete");
  5834. log.Info("删除销售订单传入值:" + JsonData);
  5835. HttpResponseMessage result = new HttpResponseMessage();
  5836. Result res = new Result();
  5837. string str = string.Empty;
  5838. try
  5839. {
  5840. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5841. {
  5842. try
  5843. {
  5844. List<ICSSalesOrder> infos = new List<ICSSalesOrder>();
  5845. try
  5846. {
  5847. infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(JsonData.ToString());
  5848. }
  5849. catch (Exception ex)
  5850. {
  5851. log.Error("转换失败:" + ex.ToString());
  5852. res.Success = false;
  5853. res.Message = "JSON格式不正确!";
  5854. }
  5855. SalesOrder action = new SalesOrder();
  5856. string resultStr = action.Delete(infos);
  5857. if (string.IsNullOrWhiteSpace(resultStr))
  5858. {
  5859. res.Success = true;
  5860. res.Message = "接口调用成功!";
  5861. }
  5862. else
  5863. {
  5864. res.Success = false;
  5865. res.Message = resultStr;
  5866. }
  5867. }
  5868. catch (Exception ex)
  5869. {
  5870. log.Error("调用后台失败:" + ex.ToString());
  5871. res.Success = false;
  5872. res.Message = ex.Message;
  5873. }
  5874. }
  5875. else
  5876. {
  5877. res.Success = false;
  5878. res.Message = "请传入参数";
  5879. }
  5880. }
  5881. catch (Exception ex)
  5882. {
  5883. log.Error("参数检验失败:" + ex.ToString());
  5884. res.Success = false;
  5885. res.Message = ex.Message;
  5886. }
  5887. finally
  5888. {
  5889. str = JsonConvert.SerializeObject(res);
  5890. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5891. }
  5892. log.Debug("删除销售订单返回值:" + str);
  5893. return result;
  5894. }
  5895. #endregion
  5896. #region 销售发货
  5897. /// <summary>
  5898. /// 获取销售发货
  5899. /// </summary>
  5900. /// <param name="JsonData"></param>
  5901. /// <returns></returns>
  5902. [Route("api/SalesDeliveryNotice/Get")]
  5903. [HttpPost]
  5904. public HttpResponseMessage GetSalesDeliveryNotice([FromBody] object JsonData)
  5905. {
  5906. log.Info("接口:api/SalesDeliveryNotice/Get");
  5907. log.Info("获取销售发货传入值:" + JsonData);
  5908. HttpResponseMessage result = new HttpResponseMessage();
  5909. Result res = new Result();
  5910. string str = string.Empty;
  5911. try
  5912. {
  5913. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5914. {
  5915. try
  5916. {
  5917. List<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>();
  5918. try
  5919. {
  5920. infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(JsonData.ToString());
  5921. }
  5922. catch (Exception ex)
  5923. {
  5924. log.Error("转换失败:" + ex.ToString());
  5925. res.Success = false;
  5926. res.Message = "JSON格式不正确!";
  5927. }
  5928. SalesDeliveryNotice action = new SalesDeliveryNotice();
  5929. string resultStr = action.Get(infos);
  5930. if (!string.IsNullOrWhiteSpace(resultStr))
  5931. {
  5932. res.Success = true;
  5933. res.Message = "接口调用成功!";
  5934. res.Data = resultStr;
  5935. }
  5936. else
  5937. {
  5938. res.Success = false;
  5939. res.Message = resultStr;
  5940. }
  5941. }
  5942. catch (Exception ex)
  5943. {
  5944. log.Error("调用后台失败:" + ex.ToString());
  5945. res.Success = false;
  5946. res.Message = ex.Message;
  5947. }
  5948. }
  5949. else
  5950. {
  5951. res.Success = false;
  5952. res.Message = "请传入参数";
  5953. }
  5954. }
  5955. catch (Exception ex)
  5956. {
  5957. log.Error("参数检验失败:" + ex.ToString());
  5958. res.Success = false;
  5959. res.Message = ex.Message;
  5960. }
  5961. finally
  5962. {
  5963. str = JsonConvert.SerializeObject(res);
  5964. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  5965. }
  5966. log.Debug("获取销售发货返回值:" + str);
  5967. return result;
  5968. }
  5969. /// <summary>
  5970. /// 创建销售发货
  5971. /// </summary>
  5972. /// <param name="JsonData"></param>
  5973. /// <returns></returns>
  5974. [Route("api/SalesDeliveryNotice/Create")]
  5975. [HttpPost]
  5976. public HttpResponseMessage CreateSalesDeliveryNotice([FromBody] object JsonData)
  5977. {
  5978. log.Info("接口:api/SalesDeliveryNotice/Create");
  5979. log.Info("创建销售发货传入值:" + JsonData);
  5980. HttpResponseMessage result = new HttpResponseMessage();
  5981. Result res = new Result();
  5982. string str = string.Empty;
  5983. try
  5984. {
  5985. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  5986. {
  5987. try
  5988. {
  5989. List<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>();
  5990. try
  5991. {
  5992. infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(JsonData.ToString());
  5993. }
  5994. catch (Exception ex)
  5995. {
  5996. log.Error("转换失败:" + ex.ToString());
  5997. res.Success = false;
  5998. res.Message = "JSON格式不正确!";
  5999. }
  6000. SalesDeliveryNotice action = new SalesDeliveryNotice();
  6001. string resultStr = action.CerateSalesDeliveryNotice(infos);
  6002. if (!string.IsNullOrWhiteSpace(resultStr))
  6003. {
  6004. res.Success = true;
  6005. res.Message = "接口调用成功!";
  6006. res.Data = resultStr;
  6007. }
  6008. else
  6009. {
  6010. res.Success = false;
  6011. res.Message = resultStr;
  6012. }
  6013. }
  6014. catch (Exception ex)
  6015. {
  6016. log.Error("调用后台失败:" + ex.ToString());
  6017. res.Success = false;
  6018. res.Message = ex.Message;
  6019. }
  6020. }
  6021. else
  6022. {
  6023. res.Success = false;
  6024. res.Message = "请传入参数";
  6025. }
  6026. }
  6027. catch (Exception ex)
  6028. {
  6029. log.Error("参数检验失败:" + ex.ToString());
  6030. res.Success = false;
  6031. res.Message = ex.Message;
  6032. }
  6033. finally
  6034. {
  6035. str = JsonConvert.SerializeObject(res);
  6036. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6037. }
  6038. log.Debug("创建销售发货返回值:" + str);
  6039. return result;
  6040. }
  6041. /// <summary>
  6042. /// 审核销售发货
  6043. /// </summary>
  6044. /// <param name="JsonData"></param>
  6045. /// <returns></returns>
  6046. [Route("api/SalesDeliveryNotice/Approve")]
  6047. [HttpPost]
  6048. public HttpResponseMessage ApproveSalesDeliveryNotice([FromBody] object JsonData)
  6049. {
  6050. log.Info("接口:api/SalesDeliveryNotice/Approve");
  6051. log.Info("审核销售发货传入值:" + JsonData);
  6052. HttpResponseMessage result = new HttpResponseMessage();
  6053. Result res = new Result();
  6054. string str = string.Empty;
  6055. try
  6056. {
  6057. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6058. {
  6059. try
  6060. {
  6061. List<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>();
  6062. try
  6063. {
  6064. infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(JsonData.ToString());
  6065. }
  6066. catch (Exception ex)
  6067. {
  6068. log.Error("转换失败:" + ex.ToString());
  6069. res.Success = false;
  6070. res.Message = "JSON格式不正确!";
  6071. }
  6072. SalesDeliveryNotice action = new SalesDeliveryNotice();
  6073. string resultStr = action.Approve(infos);
  6074. if (string.IsNullOrWhiteSpace(resultStr))
  6075. {
  6076. res.Success = true;
  6077. res.Message = "接口调用成功!";
  6078. }
  6079. else
  6080. {
  6081. res.Success = false;
  6082. res.Message = resultStr;
  6083. }
  6084. }
  6085. catch (Exception ex)
  6086. {
  6087. log.Error("调用后台失败:" + ex.ToString());
  6088. res.Success = false;
  6089. res.Message = ex.Message;
  6090. }
  6091. }
  6092. else
  6093. {
  6094. res.Success = false;
  6095. res.Message = "请传入参数";
  6096. }
  6097. }
  6098. catch (Exception ex)
  6099. {
  6100. log.Error("参数检验失败:" + ex.ToString());
  6101. res.Success = false;
  6102. res.Message = ex.Message;
  6103. }
  6104. finally
  6105. {
  6106. str = JsonConvert.SerializeObject(res);
  6107. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6108. }
  6109. log.Debug("审核销售发货返回值:" + str);
  6110. return result;
  6111. }
  6112. /// <summary>
  6113. /// 删除销售发货
  6114. /// </summary>
  6115. /// <param name="JsonData"></param>
  6116. /// <returns></returns>
  6117. [Route("api/SalesDeliveryNotice/Delete")]
  6118. [HttpPost]
  6119. public HttpResponseMessage DeleteSalesDeliveryNotice([FromBody] object JsonData)
  6120. {
  6121. log.Info("接口:api/SalesDeliveryNotice/Delete");
  6122. log.Info("删除销售发货传入值:" + JsonData);
  6123. HttpResponseMessage result = new HttpResponseMessage();
  6124. Result res = new Result();
  6125. string str = string.Empty;
  6126. try
  6127. {
  6128. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6129. {
  6130. try
  6131. {
  6132. List<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>();
  6133. try
  6134. {
  6135. infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(JsonData.ToString());
  6136. }
  6137. catch (Exception ex)
  6138. {
  6139. log.Error("转换失败:" + ex.ToString());
  6140. res.Success = false;
  6141. res.Message = "JSON格式不正确!";
  6142. }
  6143. SalesDeliveryNotice action = new SalesDeliveryNotice();
  6144. string resultStr = action.Delete(infos);
  6145. if (string.IsNullOrWhiteSpace(resultStr))
  6146. {
  6147. res.Success = true;
  6148. res.Message = "接口调用成功!";
  6149. }
  6150. else
  6151. {
  6152. res.Success = false;
  6153. res.Message = resultStr;
  6154. }
  6155. }
  6156. catch (Exception ex)
  6157. {
  6158. log.Error("调用后台失败:" + ex.ToString());
  6159. res.Success = false;
  6160. res.Message = ex.Message;
  6161. }
  6162. }
  6163. else
  6164. {
  6165. res.Success = false;
  6166. res.Message = "请传入参数";
  6167. }
  6168. }
  6169. catch (Exception ex)
  6170. {
  6171. log.Error("参数检验失败:" + ex.ToString());
  6172. res.Success = false;
  6173. res.Message = ex.Message;
  6174. }
  6175. finally
  6176. {
  6177. str = JsonConvert.SerializeObject(res);
  6178. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6179. }
  6180. log.Debug("删除销售发货返回值:" + str);
  6181. return result;
  6182. }
  6183. #endregion
  6184. #region 销售退货
  6185. /// <summary>
  6186. /// 获取销售退货
  6187. /// </summary>
  6188. /// <param name="JsonData"></param>
  6189. /// <returns></returns>
  6190. [Route("api/SalesReturnBack/Get")]
  6191. [HttpPost]
  6192. public HttpResponseMessage GetSalesReturnBack([FromBody] object JsonData)
  6193. {
  6194. log.Info("接口:api/SalesReturnBack/Get");
  6195. log.Info("获取销售退货传入值:" + JsonData);
  6196. HttpResponseMessage result = new HttpResponseMessage();
  6197. Result res = new Result();
  6198. string str = string.Empty;
  6199. try
  6200. {
  6201. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6202. {
  6203. try
  6204. {
  6205. List<ICSSalesReturnBack> infos = new List<ICSSalesReturnBack>();
  6206. try
  6207. {
  6208. infos = JsonConvert.DeserializeObject<List<ICSSalesReturnBack>>(JsonData.ToString());
  6209. }
  6210. catch (Exception ex)
  6211. {
  6212. log.Error("转换失败:" + ex.ToString());
  6213. res.Success = false;
  6214. res.Message = "JSON格式不正确!";
  6215. }
  6216. SalesReturnBack action = new SalesReturnBack();
  6217. string resultStr = action.Get(infos);
  6218. if (!string.IsNullOrWhiteSpace(resultStr))
  6219. {
  6220. res.Success = true;
  6221. res.Message = "接口调用成功!";
  6222. res.Data = resultStr;
  6223. }
  6224. else
  6225. {
  6226. res.Success = false;
  6227. res.Message = resultStr;
  6228. }
  6229. }
  6230. catch (Exception ex)
  6231. {
  6232. log.Error("调用后台失败:" + ex.ToString());
  6233. res.Success = false;
  6234. res.Message = ex.Message;
  6235. }
  6236. }
  6237. else
  6238. {
  6239. res.Success = false;
  6240. res.Message = "请传入参数";
  6241. }
  6242. }
  6243. catch (Exception ex)
  6244. {
  6245. log.Error("参数检验失败:" + ex.ToString());
  6246. res.Success = false;
  6247. res.Message = ex.Message;
  6248. }
  6249. finally
  6250. {
  6251. str = JsonConvert.SerializeObject(res);
  6252. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6253. }
  6254. log.Debug("获取销售退货返回值:" + str);
  6255. return result;
  6256. }
  6257. #endregion
  6258. #region 调拨
  6259. ///// <summary>
  6260. ///// 审核拆卸单
  6261. ///// </summary>
  6262. ///// <param name="JsonData"></param>
  6263. ///// <returns></returns>
  6264. //[Route("api/OneStepTransferDocIn/Approve")]
  6265. //[HttpPost]
  6266. //public HttpResponseMessage TransferDoc([FromBody] object JsonData)
  6267. //{
  6268. // log.Info("接口:api/OneStepTransferDocIn/Approve");
  6269. // HttpResponseMessage result = new HttpResponseMessage();
  6270. // Result res = new Result();
  6271. // string str = string.Empty;
  6272. // try
  6273. // {
  6274. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6275. // {
  6276. // log.Info("\r\n 审核拆卸单 JSON数据:" + JsonData + "\r\n");
  6277. // try
  6278. // {
  6279. // List<ICSTransferDoc> Bills = new List<ICSTransferDoc>();
  6280. // try
  6281. // {
  6282. // Bills = JsonConvert.DeserializeObject<List<ICSTransferDoc>>(JsonData.ToString());
  6283. // }
  6284. // catch (Exception ex)
  6285. // {
  6286. // log.Error("转换失败:" + ex.ToString());
  6287. // res.Success = false;
  6288. // res.Message = "JSON格式不正确!";
  6289. // }
  6290. // TransferDoc action = new TransferDoc();
  6291. // bool flag = action.ConfirmTrans(Bills);
  6292. // if (flag == false)
  6293. // {
  6294. // res.Success = false;
  6295. // res.Message = "接口调用失败!";
  6296. // }
  6297. // else
  6298. // {
  6299. // res.Success = true;
  6300. // res.Message = "接口调用成功!";
  6301. // }
  6302. // }
  6303. // catch (Exception ex)
  6304. // {
  6305. // log.Error("调用后台失败:" + ex.ToString());
  6306. // res.Success = false;
  6307. // res.Message = ex.Message;
  6308. // }
  6309. // }
  6310. // else
  6311. // {
  6312. // res.Success = false;
  6313. // res.Message = "请传入参数";
  6314. // }
  6315. // str = JsonConvert.SerializeObject(res);
  6316. // result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  6317. // log.Debug("返回值:" + str);
  6318. // return result;
  6319. // }
  6320. // catch (Exception ex)
  6321. // {
  6322. // log.Error("参数检验失败:" + ex.ToString());
  6323. // res.Success = false;
  6324. // res.Message = ex.Message;
  6325. // str = JsonConvert.SerializeObject(res);
  6326. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6327. // log.Debug("返回值:" + str);
  6328. // return result;
  6329. // }
  6330. //}
  6331. #endregion
  6332. /// <summary>
  6333. /// 无源头生成调拨单
  6334. /// </summary>
  6335. /// <param name="JsonData"></param>
  6336. /// <returns></returns>
  6337. [Route("api/OneStepTransferDocIn/Create")]
  6338. [HttpPost]
  6339. public HttpResponseMessage TransferDocIn([FromBody] object JsonData)
  6340. {
  6341. log.Info("接口:api/OneStepTransferDocIn/Create");
  6342. HttpResponseMessage result = new HttpResponseMessage();
  6343. Result res = new Result();
  6344. string str = string.Empty;
  6345. try
  6346. {
  6347. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6348. {
  6349. log.Info("\r\n 生成调拨单 JSON数据:" + JsonData + "\r\n");
  6350. try
  6351. {
  6352. List<ICSTransfer> Bills = new List<ICSTransfer>();
  6353. try
  6354. {
  6355. Bills = JsonConvert.DeserializeObject<List<ICSTransfer>>(JsonData.ToString());
  6356. }
  6357. catch (Exception ex)
  6358. {
  6359. log.Error("转换失败:" + ex.ToString());
  6360. res.Success = false;
  6361. res.Message = "JSON格式不正确!";
  6362. }
  6363. TransferDoc action = new TransferDoc();
  6364. string resultStr = action.ConfirmTransIN(Bills);
  6365. if (!string.IsNullOrWhiteSpace(resultStr))
  6366. {
  6367. res.Success = true;
  6368. res.Message = "接口调用成功!";
  6369. res.Data = resultStr;
  6370. }
  6371. else
  6372. {
  6373. res.Success = false;
  6374. res.Message = "接口调用失败!";
  6375. res.Data = resultStr;
  6376. }
  6377. }
  6378. catch (Exception ex)
  6379. {
  6380. log.Error("调用后台失败:" + ex.ToString());
  6381. res.Success = false;
  6382. res.Message = ex.Message;
  6383. }
  6384. }
  6385. else
  6386. {
  6387. res.Success = false;
  6388. res.Message = "请传入参数";
  6389. }
  6390. str = JsonConvert.SerializeObject(res);
  6391. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  6392. log.Debug("返回值:" + str);
  6393. return result;
  6394. }
  6395. catch (Exception ex)
  6396. {
  6397. log.Error("参数检验失败:" + ex.ToString());
  6398. res.Success = false;
  6399. res.Message = ex.Message;
  6400. str = JsonConvert.SerializeObject(res);
  6401. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6402. log.Debug("返回值:" + str);
  6403. return result;
  6404. }
  6405. }
  6406. #region 审核其他入库单(杂收)
  6407. ///// <summary>
  6408. ///// 其他入库单
  6409. ///// </summary>
  6410. ///// <param name="JsonData"></param>
  6411. ///// <returns></returns>
  6412. //[Route("api/OtherInDoc/Approve")]
  6413. //[HttpPost]
  6414. //public HttpResponseMessage APIConfirmRdrecord08([FromBody] object JsonData)
  6415. //{
  6416. // log.Info("接口:api/OtherInDoc/Approve");
  6417. // HttpResponseMessage result = new HttpResponseMessage();
  6418. // Result res = new Result();
  6419. // string str = string.Empty;
  6420. // try
  6421. // {
  6422. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6423. // {
  6424. // log.Info("\r\n 审核其他入库单(杂收) JSON数据:" + JsonData + "\r\n");
  6425. // try
  6426. // {
  6427. // List<ICSOtherInDoc> Bills = new List<ICSOtherInDoc>();
  6428. // try
  6429. // {
  6430. // Bills = JsonConvert.DeserializeObject<List<ICSOtherInDoc>>(JsonData.ToString());
  6431. // }
  6432. // catch (Exception ex)
  6433. // {
  6434. // log.Error("转换失败:" + ex.ToString());
  6435. // res.Success = false;
  6436. // res.Message = "JSON格式不正确!";
  6437. // }
  6438. // OtherInDoc action = new OtherInDoc();
  6439. // bool flag = action.ConfirmRd08(Bills);
  6440. // if (flag == false)
  6441. // {
  6442. // res.Success = false;
  6443. // res.Message = "接口调用失败!";
  6444. // }
  6445. // else
  6446. // {
  6447. // res.Success = true;
  6448. // res.Message = "接口调用成功!";
  6449. // }
  6450. // }
  6451. // catch (Exception ex)
  6452. // {
  6453. // log.Error("调用后台失败:" + ex.ToString());
  6454. // res.Success = false;
  6455. // res.Message = ex.Message;
  6456. // }
  6457. // }
  6458. // else
  6459. // {
  6460. // res.Success = false;
  6461. // res.Message = "请传入参数";
  6462. // }
  6463. // str = JsonConvert.SerializeObject(res);
  6464. // result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  6465. // log.Debug("返回值:" + str);
  6466. // return result;
  6467. // }
  6468. // catch (Exception ex)
  6469. // {
  6470. // log.Error("参数检验失败:" + ex.ToString());
  6471. // res.Success = false;
  6472. // res.Message = ex.Message;
  6473. // str = JsonConvert.SerializeObject(res);
  6474. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6475. // log.Debug("返回值:" + str);
  6476. // return result;
  6477. // }
  6478. //}
  6479. #endregion
  6480. #region 审核其他出库单(杂发)
  6481. ///// <summary>
  6482. ///// 审核其他出库单
  6483. ///// </summary>
  6484. ///// <param name="JsonData"></param>
  6485. ///// <returns></returns>
  6486. //[Route("api/OtherOutDoc/Approve")]
  6487. //[HttpPost]
  6488. //public HttpResponseMessage APIConfirmRdrecord09([FromBody] object JsonData)
  6489. //{
  6490. // log.Info("接口:api/OtherOutDoc/Approve");
  6491. // HttpResponseMessage result = new HttpResponseMessage();
  6492. // Result res = new Result();
  6493. // string str = string.Empty;
  6494. // try
  6495. // {
  6496. // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6497. // {
  6498. // //DBHelper.WriteLogFile("api/OtherOutDoc/Approve "+JsonData.ToString(), "Information");
  6499. // log.Info("\r\n 审核其他出库单(杂发) JSON数据:" + JsonData + "\r\n");
  6500. // try
  6501. // {
  6502. // List<ICSOtherOutDoc> Bills = new List<ICSOtherOutDoc>();
  6503. // try
  6504. // {
  6505. // Bills = JsonConvert.DeserializeObject<List<ICSOtherOutDoc>>(JsonData.ToString());
  6506. // }
  6507. // catch (Exception ex)
  6508. // {
  6509. // //DBHelper.WriteLogFile("api/OtherOutDoc/Approve " + ex.ToString(), "Information");
  6510. // log.Error("转换失败:" + ex.ToString());
  6511. // res.Success = false;
  6512. // res.Message = "JSON格式不正确!";
  6513. // }
  6514. // OtherOutDoc action = new OtherOutDoc();
  6515. // bool flag = action.ConfirmRd09(Bills);
  6516. // if (flag == false)
  6517. // {
  6518. // res.Success = false;
  6519. // res.Message = "接口调用失败!";
  6520. // }
  6521. // else
  6522. // {
  6523. // res.Success = true;
  6524. // res.Message = "接口调用成功!";
  6525. // }
  6526. // }
  6527. // catch (Exception ex)
  6528. // {
  6529. // log.Error("调用后台失败:" + ex.ToString());
  6530. // res.Success = false;
  6531. // res.Message = ex.Message;
  6532. // }
  6533. // }
  6534. // else
  6535. // {
  6536. // res.Success = false;
  6537. // res.Message = "请传入参数";
  6538. // }
  6539. // str = JsonConvert.SerializeObject(res);
  6540. // result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  6541. // log.Debug("返回值:" + str);
  6542. // return result;
  6543. // }
  6544. // catch (Exception ex)
  6545. // {
  6546. // log.Error("参数检验失败:" + ex.ToString());
  6547. // res.Success = false;
  6548. // res.Message = ex.Message;
  6549. // str = JsonConvert.SerializeObject(res);
  6550. // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6551. // log.Debug("返回值:" + str);
  6552. // return result;
  6553. // }
  6554. //}
  6555. #endregion
  6556. #region 拆卸单
  6557. /// <summary>
  6558. /// 审核拆卸单
  6559. /// </summary>
  6560. /// <param name="JsonData"></param>
  6561. /// <returns></returns>
  6562. [Route("api/DisassemblyDoc/Approve")]
  6563. [HttpPost]
  6564. public HttpResponseMessage APIConfirmDismrecord01([FromBody] object JsonData)
  6565. {
  6566. log.Info("接口:api/DisassemblyDoc/Approve");
  6567. HttpResponseMessage result = new HttpResponseMessage();
  6568. Result res = new Result();
  6569. string str = string.Empty;
  6570. try
  6571. {
  6572. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6573. {
  6574. log.Info("\r\n 审核拆卸单 JSON数据:" + JsonData + "\r\n");
  6575. try
  6576. {
  6577. List<ICSDisassemblyDoc> Bills = new List<ICSDisassemblyDoc>();
  6578. try
  6579. {
  6580. Bills = JsonConvert.DeserializeObject<List<ICSDisassemblyDoc>>(JsonData.ToString());
  6581. }
  6582. catch (Exception ex)
  6583. {
  6584. log.Error("转换失败:" + ex.ToString());
  6585. res.Success = false;
  6586. res.Message = "JSON格式不正确!";
  6587. }
  6588. DisassemblyDoc action = new DisassemblyDoc();
  6589. bool flag = action.Dismrecord01(Bills);
  6590. if (flag == false)
  6591. {
  6592. res.Success = false;
  6593. res.Message = "接口调用失败!";
  6594. }
  6595. else
  6596. {
  6597. res.Success = true;
  6598. res.Message = "接口调用成功!";
  6599. }
  6600. }
  6601. catch (Exception ex)
  6602. {
  6603. log.Error("调用后台失败:" + ex.ToString());
  6604. res.Success = false;
  6605. res.Message = ex.Message;
  6606. }
  6607. }
  6608. else
  6609. {
  6610. res.Success = false;
  6611. res.Message = "请传入参数";
  6612. }
  6613. str = JsonConvert.SerializeObject(res);
  6614. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  6615. log.Debug("返回值:" + str);
  6616. return result;
  6617. }
  6618. catch (Exception ex)
  6619. {
  6620. log.Error("参数检验失败:" + ex.ToString());
  6621. res.Success = false;
  6622. res.Message = ex.Message;
  6623. str = JsonConvert.SerializeObject(res);
  6624. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6625. log.Debug("返回值:" + str);
  6626. return result;
  6627. }
  6628. }
  6629. #endregion
  6630. #region 审核其他入库单(两步调入)
  6631. /// <summary>
  6632. /// 其他入库单
  6633. /// </summary>
  6634. /// <param name="JsonData"></param>
  6635. /// <returns></returns>
  6636. [Route("api/TwoStepTransferDocIn/Approve")]
  6637. [HttpPost]
  6638. public HttpResponseMessage APIConfirmRdrecord08Two([FromBody] object JsonData)
  6639. {
  6640. log.Info("接口:api/TwoStepTransferDocIn/Approve");
  6641. HttpResponseMessage result = new HttpResponseMessage();
  6642. Result res = new Result();
  6643. string str = string.Empty;
  6644. try
  6645. {
  6646. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6647. {
  6648. log.Info("\r\n 审核其他入库单(两步调入) JSON数据:" + JsonData + "\r\n");
  6649. try
  6650. {
  6651. List<ICSOtherInDoc> Bills = new List<ICSOtherInDoc>();
  6652. try
  6653. {
  6654. Bills = JsonConvert.DeserializeObject<List<ICSOtherInDoc>>(JsonData.ToString());
  6655. }
  6656. catch (Exception ex)
  6657. {
  6658. log.Error("转换失败:" + ex.ToString());
  6659. res.Success = false;
  6660. res.Message = "JSON格式不正确!";
  6661. }
  6662. OtherInDoc action = new OtherInDoc();
  6663. bool flag = action.ConfirmRd08(Bills);
  6664. if (flag == false)
  6665. {
  6666. res.Success = false;
  6667. res.Message = "接口调用失败!";
  6668. }
  6669. else
  6670. {
  6671. res.Success = true;
  6672. res.Message = "接口调用成功!";
  6673. }
  6674. }
  6675. catch (Exception ex)
  6676. {
  6677. log.Error("调用后台失败:" + ex.ToString());
  6678. res.Success = false;
  6679. res.Message = ex.Message;
  6680. }
  6681. }
  6682. else
  6683. {
  6684. res.Success = false;
  6685. res.Message = "请传入参数";
  6686. }
  6687. str = JsonConvert.SerializeObject(res);
  6688. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  6689. log.Debug("返回值:" + str);
  6690. return result;
  6691. }
  6692. catch (Exception ex)
  6693. {
  6694. log.Error("参数检验失败:" + ex.ToString());
  6695. res.Success = false;
  6696. res.Message = ex.Message;
  6697. str = JsonConvert.SerializeObject(res);
  6698. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6699. log.Debug("返回值:" + str);
  6700. return result;
  6701. }
  6702. }
  6703. #endregion
  6704. #region 审核其他出库单(两步调出)
  6705. /// <summary>
  6706. /// 审核其他出库单
  6707. /// </summary>
  6708. /// <param name="JsonData"></param>
  6709. /// <returns></returns>
  6710. [Route("api/TwoStepTransferDocOut/Approve")]
  6711. [HttpPost]
  6712. public HttpResponseMessage APIConfirmRdrecord09Two([FromBody] object JsonData)
  6713. {
  6714. log.Info("接口:api/TwoStepTransferDocOut/Approve");
  6715. HttpResponseMessage result = new HttpResponseMessage();
  6716. Result res = new Result();
  6717. string str = string.Empty;
  6718. try
  6719. {
  6720. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6721. {
  6722. log.Info("\r\n 审核其他出库单(两步调出) JSON数据:" + JsonData + "\r\n");
  6723. try
  6724. {
  6725. List<ICSOtherOutDoc> Bills = new List<ICSOtherOutDoc>();
  6726. try
  6727. {
  6728. Bills = JsonConvert.DeserializeObject<List<ICSOtherOutDoc>>(JsonData.ToString());
  6729. }
  6730. catch (Exception ex)
  6731. {
  6732. log.Error("转换失败:" + ex.ToString());
  6733. res.Success = false;
  6734. res.Message = "JSON格式不正确!";
  6735. }
  6736. OtherOutDoc action = new OtherOutDoc();
  6737. bool flag = action.ConfirmRd09(Bills);
  6738. if (flag == false)
  6739. {
  6740. res.Success = false;
  6741. res.Message = "接口调用失败!";
  6742. }
  6743. else
  6744. {
  6745. res.Success = true;
  6746. res.Message = "接口调用成功!";
  6747. }
  6748. }
  6749. catch (Exception ex)
  6750. {
  6751. log.Error("调用后台失败:" + ex.ToString());
  6752. res.Success = false;
  6753. res.Message = ex.Message;
  6754. }
  6755. }
  6756. else
  6757. {
  6758. res.Success = false;
  6759. res.Message = "请传入参数";
  6760. }
  6761. str = JsonConvert.SerializeObject(res);
  6762. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  6763. log.Debug("返回值:" + str);
  6764. return result;
  6765. }
  6766. catch (Exception ex)
  6767. {
  6768. log.Error("参数检验失败:" + ex.ToString());
  6769. res.Success = false;
  6770. res.Message = ex.Message;
  6771. str = JsonConvert.SerializeObject(res);
  6772. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6773. log.Debug("返回值:" + str);
  6774. return result;
  6775. }
  6776. }
  6777. #endregion
  6778. #region 委外材料出库(领料单)
  6779. [Route("api/OOIssueDocByPU/Create")]
  6780. [HttpPost]
  6781. public HttpResponseMessage CreateOOIssueDocBYPU([FromBody] object JsonData)
  6782. {
  6783. log.Info("接口:api/OOIssueDocByPU/Create");
  6784. log.Info("委外材料出库(领料单)传入值:" + JsonData);
  6785. HttpResponseMessage result = new HttpResponseMessage();
  6786. Result res = new Result();
  6787. string str = string.Empty;
  6788. try
  6789. {
  6790. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6791. {
  6792. try
  6793. {
  6794. List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
  6795. try
  6796. {
  6797. infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
  6798. }
  6799. catch (Exception ex)
  6800. {
  6801. log.Error("转换失败:" + ex.ToString());
  6802. res.Success = false;
  6803. res.Message = "JSON格式不正确!";
  6804. }
  6805. MOIssueDoc action = new MOIssueDoc();
  6806. string resultStr = action.MaterialAppVouchs(infos);
  6807. if (!string.IsNullOrWhiteSpace(resultStr))
  6808. {
  6809. res.Success = true;
  6810. res.Message = "接口调用成功!";
  6811. res.Data = resultStr;
  6812. }
  6813. else
  6814. {
  6815. res.Success = false;
  6816. res.Message = resultStr;
  6817. }
  6818. }
  6819. catch (Exception ex)
  6820. {
  6821. log.Error("调用后台失败:" + ex.ToString());
  6822. res.Success = false;
  6823. res.Message = ex.Message;
  6824. }
  6825. }
  6826. else
  6827. {
  6828. res.Success = false;
  6829. res.Message = "请传入参数";
  6830. }
  6831. }
  6832. catch (Exception ex)
  6833. {
  6834. log.Error("参数检验失败:" + ex.ToString());
  6835. res.Success = false;
  6836. res.Message = ex.Message;
  6837. }
  6838. finally
  6839. {
  6840. str = JsonConvert.SerializeObject(res);
  6841. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6842. }
  6843. log.Debug("委外材料出库(领料单)返回值:" + str);
  6844. return result;
  6845. }
  6846. #endregion
  6847. #region 开立材料出库
  6848. /// <summary>
  6849. /// 审核材料出库
  6850. /// </summary>
  6851. /// <param name="JsonData"></param>
  6852. /// <returns></returns>
  6853. [Route("api/OOIssueDoc/Approve")]
  6854. [HttpPost]
  6855. public HttpResponseMessage MOIssueDocApprove([FromBody] object JsonData)
  6856. {
  6857. log.Info("接口:api/OOIssueDoc/Approve");
  6858. log.Info("审核材料出库传入值:" + JsonData);
  6859. HttpResponseMessage result = new HttpResponseMessage();
  6860. Result res = new Result();
  6861. string str = string.Empty;
  6862. try
  6863. {
  6864. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6865. {
  6866. try
  6867. {
  6868. List<ICSMOIssueDocApprove> infos = new List<ICSMOIssueDocApprove>();
  6869. try
  6870. {
  6871. infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocApprove>>(JsonData.ToString());
  6872. }
  6873. catch (Exception ex)
  6874. {
  6875. log.Error("转换失败:" + ex.ToString());
  6876. res.Success = false;
  6877. res.Message = "JSON格式不正确!";
  6878. }
  6879. MOIssueDocApprove action = new MOIssueDocApprove();
  6880. bool flag = action.ConfirmRd11(infos);
  6881. if (flag == false)
  6882. {
  6883. res.Success = false;
  6884. res.Message = "接口调用失败!";
  6885. }
  6886. else
  6887. {
  6888. res.Success = true;
  6889. res.Message = "接口调用成功!";
  6890. }
  6891. }
  6892. catch (Exception ex)
  6893. {
  6894. log.Error("调用后台失败:" + ex.ToString());
  6895. res.Success = false;
  6896. res.Message = ex.Message;
  6897. }
  6898. }
  6899. else
  6900. {
  6901. res.Success = false;
  6902. res.Message = "请传入参数";
  6903. }
  6904. str = JsonConvert.SerializeObject(res);
  6905. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  6906. log.Debug("返回值:" + str);
  6907. return result;
  6908. }
  6909. catch (Exception ex)
  6910. {
  6911. log.Error("参数检验失败:" + ex.ToString());
  6912. res.Success = false;
  6913. res.Message = ex.Message;
  6914. str = JsonConvert.SerializeObject(res);
  6915. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6916. log.Debug("审核材料出库返回值:" + str);
  6917. return result;
  6918. }
  6919. }
  6920. #endregion
  6921. #region 借用(生成其他出库)
  6922. /// <summary>
  6923. /// 借用
  6924. /// </summary>
  6925. /// <param name="JsonData"></param>
  6926. /// <returns></returns>
  6927. [Route("api/BrrowDoc/Create")]
  6928. [HttpPost]
  6929. public HttpResponseMessage BrrowDocCreate([FromBody] object JsonData)
  6930. {
  6931. log.Info("接口:api/BrrowDoc/Create");
  6932. log.Info("借用(生成其他出库)传入值:" + JsonData);
  6933. HttpResponseMessage result = new HttpResponseMessage();
  6934. Result res = new Result();
  6935. string str = string.Empty;
  6936. try
  6937. {
  6938. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  6939. {
  6940. try
  6941. {
  6942. List<ICSBrrowDoc> infos = new List<ICSBrrowDoc>();
  6943. try
  6944. {
  6945. infos = JsonConvert.DeserializeObject<List<ICSBrrowDoc>>(JsonData.ToString());
  6946. }
  6947. catch (Exception ex)
  6948. {
  6949. log.Error("转换失败:" + ex.ToString());
  6950. res.Success = false;
  6951. res.Message = "JSON格式不正确!";
  6952. }
  6953. BrrowDoc action = new BrrowDoc();
  6954. string resultStr = action.ConfirmRd09(infos);
  6955. if (!string.IsNullOrWhiteSpace(resultStr))
  6956. {
  6957. res.Success = true;
  6958. res.Message = "接口调用成功!";
  6959. res.Data = resultStr;
  6960. }
  6961. else
  6962. {
  6963. res.Success = false;
  6964. res.Data = resultStr;
  6965. }
  6966. }
  6967. catch (Exception ex)
  6968. {
  6969. log.Error("调用后台失败:" + ex.ToString());
  6970. res.Success = false;
  6971. res.Message = ex.Message;
  6972. }
  6973. }
  6974. else
  6975. {
  6976. res.Success = false;
  6977. res.Message = "请传入参数";
  6978. }
  6979. str = JsonConvert.SerializeObject(res);
  6980. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  6981. log.Debug("返回值:" + str);
  6982. return result;
  6983. }
  6984. catch (Exception ex)
  6985. {
  6986. log.Error("参数检验失败:" + ex.ToString());
  6987. res.Success = false;
  6988. res.Message = ex.Message;
  6989. str = JsonConvert.SerializeObject(res);
  6990. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  6991. log.Debug("借用(生成其他出库)返回值:" + str);
  6992. return result;
  6993. }
  6994. }
  6995. #endregion
  6996. #region 归还(生成其他入库)
  6997. /// <summary>
  6998. /// 归还(生成其他入库)
  6999. /// </summary>
  7000. /// <param name="JsonData"></param>
  7001. /// <returns></returns>
  7002. [Route("api/ReturnDoc/Create")]
  7003. [HttpPost]
  7004. public HttpResponseMessage ReturnDocCreate([FromBody] object JsonData)
  7005. {
  7006. log.Info("接口:api/ReturnDoc/Create");
  7007. log.Info("归还(生成其他入库)传入值:" + JsonData);
  7008. HttpResponseMessage result = new HttpResponseMessage();
  7009. Result res = new Result();
  7010. string str = string.Empty;
  7011. try
  7012. {
  7013. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7014. {
  7015. try
  7016. {
  7017. List<ICSReturnDoc> infos = new List<ICSReturnDoc>();
  7018. try
  7019. {
  7020. infos = JsonConvert.DeserializeObject<List<ICSReturnDoc>>(JsonData.ToString());
  7021. }
  7022. catch (Exception ex)
  7023. {
  7024. log.Error("转换失败:" + ex.ToString());
  7025. res.Success = false;
  7026. res.Message = "JSON格式不正确!";
  7027. }
  7028. ReturnDoc action = new ReturnDoc();
  7029. string resultStr = action.ConfirmRd08(infos);
  7030. if (!string.IsNullOrWhiteSpace(resultStr))
  7031. {
  7032. res.Success = true;
  7033. res.Message = "接口调用成功!";
  7034. res.Data = resultStr;
  7035. }
  7036. else
  7037. {
  7038. res.Success = false;
  7039. res.Data = resultStr;
  7040. }
  7041. }
  7042. catch (Exception ex)
  7043. {
  7044. log.Error("调用后台失败:" + ex.ToString());
  7045. res.Success = false;
  7046. res.Message = ex.Message;
  7047. }
  7048. }
  7049. else
  7050. {
  7051. res.Success = false;
  7052. res.Message = "请传入参数";
  7053. }
  7054. str = JsonConvert.SerializeObject(res);
  7055. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  7056. log.Debug("返回值:" + str);
  7057. return result;
  7058. }
  7059. catch (Exception ex)
  7060. {
  7061. log.Error("参数检验失败:" + ex.ToString());
  7062. res.Success = false;
  7063. res.Message = ex.Message;
  7064. str = JsonConvert.SerializeObject(res);
  7065. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7066. log.Debug("归还(生成其他入库)返回值:" + str);
  7067. return result;
  7068. }
  7069. }
  7070. #endregion
  7071. #region 形态转换单
  7072. /// <summary>
  7073. /// 形态转换单
  7074. /// </summary>
  7075. /// <param name="JsonData"></param>
  7076. /// <returns></returns>
  7077. [Route("api/MorphologicalTransformationDoc/Create")]
  7078. [HttpPost]
  7079. public HttpResponseMessage MorphologicalTransformationDocCreate([FromBody] object JsonData)
  7080. {
  7081. log.Info("接口:api/MorphologicalTransformationDoc/Create");
  7082. log.Info("形态转换单传入值:" + JsonData);
  7083. HttpResponseMessage result = new HttpResponseMessage();
  7084. Result res = new Result();
  7085. string str = string.Empty;
  7086. try
  7087. {
  7088. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7089. {
  7090. try
  7091. {
  7092. List<ICSAssemVouch> infos = new List<ICSAssemVouch>();
  7093. try
  7094. {
  7095. infos = JsonConvert.DeserializeObject<List<ICSAssemVouch>>(JsonData.ToString());
  7096. }
  7097. catch (Exception ex)
  7098. {
  7099. log.Error("转换失败:" + ex.ToString());
  7100. res.Success = false;
  7101. res.Message = "JSON格式不正确!";
  7102. }
  7103. CreateAssemVouch action = new CreateAssemVouch();
  7104. string resultStr = action.Create(infos);
  7105. if (!string.IsNullOrWhiteSpace(resultStr))
  7106. {
  7107. res.Success = true;
  7108. res.Message = "接口调用成功!";
  7109. res.Data = resultStr;
  7110. }
  7111. else
  7112. {
  7113. res.Success = false;
  7114. res.Data = resultStr;
  7115. }
  7116. }
  7117. catch (Exception ex)
  7118. {
  7119. log.Error("调用后台失败:" + ex.ToString());
  7120. res.Success = false;
  7121. res.Message = ex.Message;
  7122. }
  7123. }
  7124. else
  7125. {
  7126. res.Success = false;
  7127. res.Message = "请传入参数";
  7128. }
  7129. str = JsonConvert.SerializeObject(res);
  7130. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  7131. log.Debug("返回值:" + str);
  7132. return result;
  7133. }
  7134. catch (Exception ex)
  7135. {
  7136. log.Error("参数检验失败:" + ex.ToString());
  7137. res.Success = false;
  7138. res.Message = ex.Message;
  7139. str = JsonConvert.SerializeObject(res);
  7140. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7141. log.Debug("形态转换单返回值:" + str);
  7142. return result;
  7143. }
  7144. }
  7145. #endregion
  7146. #region 齐套检验接口
  7147. /// <summary>
  7148. /// 齐套检验接口
  7149. /// </summary>
  7150. /// <param name="JsonData"></param>
  7151. /// <returns></returns>
  7152. [Route("api/Complete/Approve")]
  7153. [HttpPost]
  7154. public HttpResponseMessage CompleteCreate([FromBody] object JsonData)
  7155. {
  7156. log.Info("接口:api/ReturnDoc/Approve");
  7157. log.Info("齐套检验接口传入值:" + JsonData);
  7158. HttpResponseMessage result = new HttpResponseMessage();
  7159. Result res = new Result();
  7160. string str = string.Empty;
  7161. try
  7162. {
  7163. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7164. {
  7165. try
  7166. {
  7167. List<Complete> infos = new List<Complete>();
  7168. try
  7169. {
  7170. infos = JsonConvert.DeserializeObject<List<Complete>>(JsonData.ToString());
  7171. }
  7172. catch (Exception ex)
  7173. {
  7174. log.Error("转换失败:" + ex.ToString());
  7175. res.Success = false;
  7176. res.Message = "JSON格式不正确!";
  7177. }
  7178. ISComplete action = new ISComplete();
  7179. string resultStr = action.ConfirmRd08(infos);
  7180. if (!string.IsNullOrWhiteSpace(resultStr))
  7181. {
  7182. res.Success = true;
  7183. res.Message = "接口调用成功!";
  7184. res.Data = resultStr;
  7185. }
  7186. else
  7187. {
  7188. res.Success = false;
  7189. res.Data = resultStr;
  7190. }
  7191. }
  7192. catch (Exception ex)
  7193. {
  7194. log.Error("调用后台失败:" + ex.ToString());
  7195. res.Success = false;
  7196. res.Message = ex.Message;
  7197. }
  7198. }
  7199. else
  7200. {
  7201. res.Success = false;
  7202. res.Message = "请传入参数";
  7203. }
  7204. str = JsonConvert.SerializeObject(res);
  7205. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  7206. log.Debug("返回值:" + str);
  7207. return result;
  7208. }
  7209. catch (Exception ex)
  7210. {
  7211. log.Error("参数检验失败:" + ex.ToString());
  7212. res.Success = false;
  7213. res.Message = ex.Message;
  7214. str = JsonConvert.SerializeObject(res);
  7215. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7216. log.Debug("齐套检验返回值:" + str);
  7217. return result;
  7218. }
  7219. }
  7220. #endregion
  7221. /// <summary>
  7222. /// 来源头生成调拨单
  7223. /// </summary>
  7224. /// <param name="JsonData"></param>
  7225. /// <returns></returns>
  7226. [Route("api/OneStepTransferDoc/Create")]
  7227. [HttpPost]
  7228. public HttpResponseMessage TransferDocSIn([FromBody] object JsonData)
  7229. {
  7230. log.Info("接口:api/OneStepTransferDoc/Create");
  7231. HttpResponseMessage result = new HttpResponseMessage();
  7232. Result res = new Result();
  7233. string str = string.Empty;
  7234. try
  7235. {
  7236. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7237. {
  7238. log.Info("\r\n 生成调拨单 JSON数据:" + JsonData + "\r\n");
  7239. try
  7240. {
  7241. List<ICSTransfer> Bills = new List<ICSTransfer>();
  7242. try
  7243. {
  7244. Bills = JsonConvert.DeserializeObject<List<ICSTransfer>>(JsonData.ToString());
  7245. }
  7246. catch (Exception ex)
  7247. {
  7248. log.Error("转换失败:" + ex.ToString());
  7249. res.Success = false;
  7250. res.Message = "JSON格式不正确!";
  7251. }
  7252. TransferDoc action = new TransferDoc();
  7253. string resultStr = action.ConfirmTrans(Bills);
  7254. if (!string.IsNullOrWhiteSpace(resultStr))
  7255. {
  7256. res.Success = true;
  7257. res.Message = "接口调用成功!";
  7258. res.Data = resultStr;
  7259. }
  7260. else
  7261. {
  7262. res.Success = false;
  7263. res.Message = "接口调用失败!";
  7264. res.Data = resultStr;
  7265. }
  7266. }
  7267. catch (Exception ex)
  7268. {
  7269. log.Error("调用后台失败:" + ex.ToString());
  7270. res.Success = false;
  7271. res.Message = ex.Message;
  7272. }
  7273. }
  7274. else
  7275. {
  7276. res.Success = false;
  7277. res.Message = "请传入参数";
  7278. }
  7279. str = JsonConvert.SerializeObject(res);
  7280. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  7281. log.Debug("返回值:" + str);
  7282. return result;
  7283. }
  7284. catch (Exception ex)
  7285. {
  7286. log.Error("参数检验失败:" + ex.ToString());
  7287. res.Success = false;
  7288. res.Message = ex.Message;
  7289. str = JsonConvert.SerializeObject(res);
  7290. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7291. log.Debug("返回值:" + str);
  7292. return result;
  7293. }
  7294. }
  7295. #region U9入库单相关
  7296. #region 审核入库单(采购入库)
  7297. [Route("api/PurchaseReceiveDocPOArrive/Create")]
  7298. [HttpPost]
  7299. public HttpResponseMessage ApproveRCV([FromBody] object JsonData)
  7300. {
  7301. log.Info("接口:api/ApproveRCV/Approve");
  7302. log.Info("审核入库单传入值:" + JsonData);
  7303. HttpResponseMessage result = new HttpResponseMessage();
  7304. Result res = new Result();
  7305. string str = string.Empty;
  7306. try
  7307. {
  7308. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7309. {
  7310. try
  7311. {
  7312. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  7313. try
  7314. {
  7315. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  7316. }
  7317. catch (Exception ex)
  7318. {
  7319. log.Error("转换失败:" + ex.ToString());
  7320. res.Success = false;
  7321. res.Message = "JSON格式不正确!";
  7322. }
  7323. ApproveRCV action = new ApproveRCV();
  7324. bool approveresult = action.Approve(infos);
  7325. if (approveresult == true)
  7326. {
  7327. res.Success = true;
  7328. res.Message = "接口调用成功!";
  7329. }
  7330. else
  7331. {
  7332. res.Success = false;
  7333. res.Message = "接口调用失败";
  7334. }
  7335. }
  7336. catch (Exception ex)
  7337. {
  7338. log.Error("调用后台失败:" + ex.ToString());
  7339. res.Success = false;
  7340. res.Message = ex.Message;
  7341. }
  7342. }
  7343. else
  7344. {
  7345. res.Success = false;
  7346. res.Message = "请传入参数";
  7347. }
  7348. }
  7349. catch (Exception ex)
  7350. {
  7351. log.Error("参数检验失败:" + ex.ToString());
  7352. res.Success = false;
  7353. res.Message = ex.Message;
  7354. }
  7355. finally
  7356. {
  7357. str = JsonConvert.SerializeObject(res);
  7358. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7359. }
  7360. log.Debug("审核采购入库单返回值:" + str);
  7361. return result;
  7362. }
  7363. #endregion
  7364. #region 审核入库单(采购退货)
  7365. [Route("api/PurchaseReceiveDoctNegative/Create")]
  7366. [HttpPost]
  7367. public HttpResponseMessage CreatePurchaseReceiveDoctNegative([FromBody] object JsonData)
  7368. {
  7369. log.Info("接口:api/PurchaseReceiveDoctNegative/Create");
  7370. log.Info("创建采购红字入库单传入值:" + JsonData);
  7371. HttpResponseMessage result = new HttpResponseMessage();
  7372. Result res = new Result();
  7373. string str = string.Empty;
  7374. try
  7375. {
  7376. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7377. {
  7378. try
  7379. {
  7380. List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
  7381. try
  7382. {
  7383. infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
  7384. }
  7385. catch (Exception ex)
  7386. {
  7387. log.Error("转换失败:" + ex.ToString());
  7388. res.Success = false;
  7389. res.Message = "JSON格式不正确!";
  7390. throw new Exception(res.Message);
  7391. }
  7392. ApproveRCV action = new ApproveRCV();
  7393. bool approveresult = action.Approve(infos);
  7394. if (approveresult == true)
  7395. {
  7396. res.Success = true;
  7397. res.Message = "接口调用成功!";
  7398. }
  7399. else
  7400. {
  7401. res.Success = false;
  7402. res.Message = "接口调用失败";
  7403. }
  7404. }
  7405. catch (Exception ex)
  7406. {
  7407. log.Error("调用后台失败:" + ex.ToString());
  7408. res.Success = false;
  7409. res.Message = ex.Message;
  7410. }
  7411. }
  7412. else
  7413. {
  7414. res.Success = false;
  7415. res.Message = "请传入参数";
  7416. }
  7417. }
  7418. catch (Exception ex)
  7419. {
  7420. log.Error("参数检验失败:" + ex.ToString());
  7421. res.Success = false;
  7422. res.Message = ex.Message;
  7423. }
  7424. finally
  7425. {
  7426. str = JsonConvert.SerializeObject(res);
  7427. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7428. }
  7429. log.Debug("创建采购红字入库单返回值:" + str);
  7430. return result;
  7431. }
  7432. #endregion
  7433. #region 审核入库单(销售退货)
  7434. [Route("api/SalesShipmentDocNegative/Create")]
  7435. [HttpPost]
  7436. public HttpResponseMessage CreateSalesShipmentDocNegative([FromBody] object JsonData)
  7437. {
  7438. log.Info("接口:api/SalesShipmentDocNegative/Create,");
  7439. log.Info("创建销售出库单传入值:" + JsonData);
  7440. HttpResponseMessage result = new HttpResponseMessage();
  7441. Result res = new Result();
  7442. string str = string.Empty;
  7443. try
  7444. {
  7445. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7446. {
  7447. try
  7448. {
  7449. List<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>();
  7450. try
  7451. {
  7452. infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(JsonData.ToString());
  7453. }
  7454. catch (Exception ex)
  7455. {
  7456. log.Error("转换失败:" + ex.ToString());
  7457. res.Success = false;
  7458. res.Message = "JSON格式不正确!";
  7459. }
  7460. ApproveRCV action = new ApproveRCV();
  7461. bool approveresult = action.Approve(infos);
  7462. if (approveresult == true)
  7463. {
  7464. res.Success = true;
  7465. res.Message = "接口调用成功!";
  7466. }
  7467. else
  7468. {
  7469. res.Success = false;
  7470. res.Message = "接口调用失败";
  7471. }
  7472. }
  7473. catch (Exception ex)
  7474. {
  7475. log.Error("调用后台失败:" + ex.ToString());
  7476. res.Success = false;
  7477. res.Message = ex.Message;
  7478. }
  7479. }
  7480. else
  7481. {
  7482. res.Success = false;
  7483. res.Message = "请传入参数";
  7484. }
  7485. }
  7486. catch (Exception ex)
  7487. {
  7488. log.Error("参数检验失败:" + ex.ToString());
  7489. res.Success = false;
  7490. res.Message = ex.Message;
  7491. }
  7492. finally
  7493. {
  7494. str = JsonConvert.SerializeObject(res);
  7495. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7496. }
  7497. log.Debug("创建销售出库单返回值:" + str);
  7498. return result;
  7499. }
  7500. #endregion
  7501. #region 创建完工报告(成品入库)
  7502. [Route("api/ManufactureReceiveDoc/Create")]
  7503. [HttpPost]
  7504. public HttpResponseMessage CreateManufactureReceiveDoc([FromBody] object JsonData)
  7505. {
  7506. log.Info("接口:api/ManufactureReceiveDoc/Create");
  7507. log.Info("创建成品入库单传入值:" + JsonData);
  7508. HttpResponseMessage result = new HttpResponseMessage();
  7509. Result res = new Result();
  7510. string str = string.Empty;
  7511. try
  7512. {
  7513. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7514. {
  7515. try
  7516. {
  7517. List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
  7518. try
  7519. {
  7520. infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
  7521. }
  7522. catch (Exception ex)
  7523. {
  7524. log.Error("转换失败:" + ex.ToString());
  7525. res.Success = false;
  7526. res.Message = "JSON格式不正确!";
  7527. }
  7528. CreateCompRpt action = new CreateCompRpt();
  7529. string resultStr = action.Create(infos);
  7530. if (!string.IsNullOrWhiteSpace(resultStr))
  7531. {
  7532. res.Success = true;
  7533. res.Message = "接口调用成功!";
  7534. res.Data = resultStr;
  7535. }
  7536. else
  7537. {
  7538. res.Success = false;
  7539. res.Message = resultStr;
  7540. }
  7541. }
  7542. catch (Exception ex)
  7543. {
  7544. log.Error("调用后台失败:" + ex.ToString());
  7545. res.Success = false;
  7546. res.Message = ex.Message;
  7547. }
  7548. }
  7549. else
  7550. {
  7551. res.Success = false;
  7552. res.Message = "请传入参数";
  7553. }
  7554. }
  7555. catch (Exception ex)
  7556. {
  7557. log.Error("参数检验失败:" + ex.ToString());
  7558. res.Success = false;
  7559. res.Message = ex.Message;
  7560. }
  7561. finally
  7562. {
  7563. str = JsonConvert.SerializeObject(res);
  7564. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7565. }
  7566. log.Debug("创建成品入库单返回值:" + str);
  7567. return result;
  7568. }
  7569. #endregion
  7570. #region 审核杂收单(其他入库)
  7571. [Route("api/OtherInDoc/Approve")]
  7572. [HttpPost]
  7573. public HttpResponseMessage APIConfirmRdrecord08([FromBody] object JsonData)
  7574. {
  7575. log.Info("接口:api/OtherInDoc/Approve");
  7576. HttpResponseMessage result = new HttpResponseMessage();
  7577. Result res = new Result();
  7578. string str = string.Empty;
  7579. try
  7580. {
  7581. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7582. {
  7583. log.Info("\r\n 审核其他入库单(杂收) JSON数据:" + JsonData + "\r\n");
  7584. try
  7585. {
  7586. List<ICSOtherInDoc> Bills = new List<ICSOtherInDoc>();
  7587. try
  7588. {
  7589. Bills = JsonConvert.DeserializeObject<List<ICSOtherInDoc>>(JsonData.ToString());
  7590. }
  7591. catch (Exception ex)
  7592. {
  7593. log.Error("转换失败:" + ex.ToString());
  7594. res.Success = false;
  7595. res.Message = "JSON格式不正确!";
  7596. }
  7597. ApproveMiscRcv action = new ApproveMiscRcv();
  7598. bool flag = action.Approve(Bills);
  7599. if (flag == false)
  7600. {
  7601. res.Success = false;
  7602. res.Message = "接口调用失败!";
  7603. }
  7604. else
  7605. {
  7606. res.Success = true;
  7607. res.Message = "接口调用成功!";
  7608. }
  7609. }
  7610. catch (Exception ex)
  7611. {
  7612. log.Error("调用后台失败:" + ex.ToString());
  7613. res.Success = false;
  7614. res.Message = ex.Message;
  7615. }
  7616. }
  7617. else
  7618. {
  7619. res.Success = false;
  7620. res.Message = "请传入参数";
  7621. }
  7622. str = JsonConvert.SerializeObject(res);
  7623. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  7624. log.Debug("返回值:" + str);
  7625. return result;
  7626. }
  7627. catch (Exception ex)
  7628. {
  7629. log.Error("参数检验失败:" + ex.ToString());
  7630. res.Success = false;
  7631. res.Message = ex.Message;
  7632. str = JsonConvert.SerializeObject(res);
  7633. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7634. log.Debug("返回值:" + str);
  7635. return result;
  7636. }
  7637. }
  7638. #endregion
  7639. #endregion
  7640. #region U9领料相关
  7641. #region 审核生产领料单(材料出库)
  7642. [Route("api/MOIssueDoc/Approve")]
  7643. [HttpPost]
  7644. public HttpResponseMessage ApproveIssue([FromBody] object JsonData)
  7645. {
  7646. log.Info("接口:api/MOIssueDoc/Approve");
  7647. log.Info("审核入库单传入值:" + JsonData);
  7648. HttpResponseMessage result = new HttpResponseMessage();
  7649. Result res = new Result();
  7650. string str = string.Empty;
  7651. try
  7652. {
  7653. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7654. {
  7655. try
  7656. {
  7657. List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
  7658. try
  7659. {
  7660. infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
  7661. }
  7662. catch (Exception ex)
  7663. {
  7664. log.Error("转换失败:" + ex.ToString());
  7665. res.Success = false;
  7666. res.Message = "JSON格式不正确!";
  7667. }
  7668. ApproveIssue action = new ApproveIssue();
  7669. bool approveresult = action.Approve(infos);
  7670. if (approveresult == true)
  7671. {
  7672. res.Success = true;
  7673. res.Message = "接口调用成功!";
  7674. }
  7675. else
  7676. {
  7677. res.Success = false;
  7678. res.Message = "接口调用失败";
  7679. }
  7680. }
  7681. catch (Exception ex)
  7682. {
  7683. log.Error("调用后台失败:" + ex.ToString());
  7684. res.Success = false;
  7685. res.Message = ex.Message;
  7686. }
  7687. }
  7688. else
  7689. {
  7690. res.Success = false;
  7691. res.Message = "请传入参数";
  7692. }
  7693. }
  7694. catch (Exception ex)
  7695. {
  7696. log.Error("参数检验失败:" + ex.ToString());
  7697. res.Success = false;
  7698. res.Message = ex.Message;
  7699. }
  7700. finally
  7701. {
  7702. str = JsonConvert.SerializeObject(res);
  7703. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7704. }
  7705. log.Debug("审核生产领料单返回值:" + str);
  7706. return result;
  7707. }
  7708. #endregion
  7709. #region 创建生产退料单(物料回仓)
  7710. [Route("api/MOIssueDocNegative/Create")]
  7711. [HttpPost]
  7712. public HttpResponseMessage CreateMOIssueDocNegatives([FromBody] object JsonData)
  7713. {
  7714. log.Info("接口:api/MOIssueDocNegative/Create");
  7715. log.Info("创建生产退料单传入值:" + JsonData);
  7716. HttpResponseMessage result = new HttpResponseMessage();
  7717. Result res = new Result();
  7718. string str = string.Empty;
  7719. try
  7720. {
  7721. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7722. {
  7723. try
  7724. {
  7725. List<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>();
  7726. try
  7727. {
  7728. infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(JsonData.ToString());
  7729. }
  7730. catch (Exception ex)
  7731. {
  7732. log.Error("转换失败:" + ex.ToString());
  7733. res.Success = false;
  7734. res.Message = "JSON格式不正确!";
  7735. }
  7736. CreateIssue action = new CreateIssue();
  7737. string resultStr = action.Create(infos);
  7738. if (!string.IsNullOrWhiteSpace(resultStr))
  7739. {
  7740. res.Success = true;
  7741. res.Message = "接口调用成功!";
  7742. res.Data = resultStr;
  7743. }
  7744. else
  7745. {
  7746. res.Success = false;
  7747. res.Message = resultStr;
  7748. }
  7749. }
  7750. catch (Exception ex)
  7751. {
  7752. log.Error("调用后台失败:" + ex.ToString());
  7753. res.Success = false;
  7754. res.Message = ex.Message;
  7755. }
  7756. }
  7757. else
  7758. {
  7759. res.Success = false;
  7760. res.Message = "请传入参数";
  7761. }
  7762. }
  7763. catch (Exception ex)
  7764. {
  7765. log.Error("参数检验失败:" + ex.ToString());
  7766. res.Success = false;
  7767. res.Message = ex.Message;
  7768. }
  7769. finally
  7770. {
  7771. str = JsonConvert.SerializeObject(res);
  7772. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7773. }
  7774. log.Debug("创建生产退料单返回值:" + str);
  7775. return result;
  7776. }
  7777. #endregion
  7778. #endregion
  7779. #region U9出库相关
  7780. #region 审核标准出货单(销售出库)
  7781. [Route("api/SalesShipmentDoc/Create")]
  7782. [HttpPost]
  7783. public HttpResponseMessage CreateSalesShipmentDoc([FromBody] object JsonData)
  7784. {
  7785. log.Info("接口:api/SalesShipmentDoc/Create");
  7786. log.Info("创建销售出库单传入值:" + JsonData);
  7787. HttpResponseMessage result = new HttpResponseMessage();
  7788. Result res = new Result();
  7789. string str = string.Empty;
  7790. try
  7791. {
  7792. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7793. {
  7794. try
  7795. {
  7796. List<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>();
  7797. try
  7798. {
  7799. infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(JsonData.ToString());
  7800. }
  7801. catch (Exception ex)
  7802. {
  7803. log.Error("转换失败:" + ex.ToString());
  7804. res.Success = false;
  7805. res.Message = "JSON格式不正确!";
  7806. }
  7807. ApproveShipment action = new ApproveShipment();
  7808. bool ApproveResult = action.Approve(infos);
  7809. if (ApproveResult==true)
  7810. {
  7811. res.Success = true;
  7812. res.Message = "接口调用成功!";
  7813. }
  7814. else
  7815. {
  7816. res.Success = false;
  7817. res.Message = "接口调用失败!";
  7818. }
  7819. }
  7820. catch (Exception ex)
  7821. {
  7822. log.Error("调用后台失败:" + ex.ToString());
  7823. res.Success = false;
  7824. res.Message = ex.Message;
  7825. }
  7826. }
  7827. else
  7828. {
  7829. res.Success = false;
  7830. res.Message = "请传入参数";
  7831. }
  7832. }
  7833. catch (Exception ex)
  7834. {
  7835. log.Error("参数检验失败:" + ex.ToString());
  7836. res.Success = false;
  7837. res.Message = ex.Message;
  7838. }
  7839. finally
  7840. {
  7841. str = JsonConvert.SerializeObject(res);
  7842. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7843. }
  7844. log.Debug("审核销售出库单返回值:" + str);
  7845. return result;
  7846. }
  7847. #endregion
  7848. #region 审核杂发单(其他出库)
  7849. [Route("api/OtherOutDoc/Approve")]
  7850. [HttpPost]
  7851. public HttpResponseMessage APIConfirmRdrecord09([FromBody] object JsonData)
  7852. {
  7853. log.Info("接口:api/OtherOutDoc/Approve");
  7854. HttpResponseMessage result = new HttpResponseMessage();
  7855. Result res = new Result();
  7856. string str = string.Empty;
  7857. try
  7858. {
  7859. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7860. {
  7861. //DBHelper.WriteLogFile("api/OtherOutDoc/Approve "+JsonData.ToString(), "Information");
  7862. log.Info("\r\n 审核其他出库单(杂发) JSON数据:" + JsonData + "\r\n");
  7863. try
  7864. {
  7865. List<ICSOtherOutDoc> Bills = new List<ICSOtherOutDoc>();
  7866. try
  7867. {
  7868. Bills = JsonConvert.DeserializeObject<List<ICSOtherOutDoc>>(JsonData.ToString());
  7869. }
  7870. catch (Exception ex)
  7871. {
  7872. //DBHelper.WriteLogFile("api/OtherOutDoc/Approve " + ex.ToString(), "Information");
  7873. log.Error("转换失败:" + ex.ToString());
  7874. res.Success = false;
  7875. res.Message = "JSON格式不正确!";
  7876. }
  7877. ApproveMiscShip action = new ApproveMiscShip();
  7878. bool flag = action.Approve(Bills);
  7879. if (flag == false)
  7880. {
  7881. res.Success = false;
  7882. res.Message = "接口调用失败!";
  7883. }
  7884. else
  7885. {
  7886. res.Success = true;
  7887. res.Message = "接口调用成功!";
  7888. }
  7889. }
  7890. catch (Exception ex)
  7891. {
  7892. log.Error("调用后台失败:" + ex.ToString());
  7893. res.Success = false;
  7894. res.Message = ex.Message;
  7895. }
  7896. }
  7897. else
  7898. {
  7899. res.Success = false;
  7900. res.Message = "请传入参数";
  7901. }
  7902. str = JsonConvert.SerializeObject(res);
  7903. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  7904. log.Debug("返回值:" + str);
  7905. return result;
  7906. }
  7907. catch (Exception ex)
  7908. {
  7909. log.Error("参数检验失败:" + ex.ToString());
  7910. res.Success = false;
  7911. res.Message = ex.Message;
  7912. str = JsonConvert.SerializeObject(res);
  7913. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7914. log.Debug("返回值:" + str);
  7915. return result;
  7916. }
  7917. }
  7918. #endregion
  7919. #endregion
  7920. #region U9库内作业
  7921. #region 审核调入单(一步调入)
  7922. [Route("api/OneStepTransferDocIn/Approve")]
  7923. [HttpPost]
  7924. public HttpResponseMessage TransferDoc([FromBody] object JsonData)
  7925. {
  7926. log.Info("接口:api/OneStepTransferDocIn/Approve");
  7927. HttpResponseMessage result = new HttpResponseMessage();
  7928. Result res = new Result();
  7929. string str = string.Empty;
  7930. try
  7931. {
  7932. if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
  7933. {
  7934. log.Info("\r\n 审核拆卸单 JSON数据:" + JsonData + "\r\n");
  7935. try
  7936. {
  7937. List<ICSTransferDoc> Bills = new List<ICSTransferDoc>();
  7938. try
  7939. {
  7940. Bills = JsonConvert.DeserializeObject<List<ICSTransferDoc>>(JsonData.ToString());
  7941. }
  7942. catch (Exception ex)
  7943. {
  7944. log.Error("转换失败:" + ex.ToString());
  7945. res.Success = false;
  7946. res.Message = "JSON格式不正确!";
  7947. }
  7948. ApproveTransferIN action = new ApproveTransferIN();
  7949. bool flag = action.Approve(Bills);
  7950. if (flag == false)
  7951. {
  7952. res.Success = false;
  7953. res.Message = "接口调用失败!";
  7954. }
  7955. else
  7956. {
  7957. res.Success = true;
  7958. res.Message = "接口调用成功!";
  7959. }
  7960. }
  7961. catch (Exception ex)
  7962. {
  7963. log.Error("调用后台失败:" + ex.ToString());
  7964. res.Success = false;
  7965. res.Message = ex.Message;
  7966. }
  7967. }
  7968. else
  7969. {
  7970. res.Success = false;
  7971. res.Message = "请传入参数";
  7972. }
  7973. str = JsonConvert.SerializeObject(res);
  7974. result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
  7975. log.Debug("返回值:" + str);
  7976. return result;
  7977. }
  7978. catch (Exception ex)
  7979. {
  7980. log.Error("参数检验失败:" + ex.ToString());
  7981. res.Success = false;
  7982. res.Message = ex.Message;
  7983. str = JsonConvert.SerializeObject(res);
  7984. result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
  7985. log.Debug("返回值:" + str);
  7986. return result;
  7987. }
  7988. }
  7989. #endregion
  7990. #endregion
  7991. }
  7992. }
  7993. //BrrowDoc√
  7994. //CreatePOArrive√
  7995. //CreatePuArrivalVouch√
  7996. //DeliveryNotice√
  7997. //ManufactureReceiveDoc√
  7998. //MOIssueDoc√
  7999. //MOIssueDocNegatives√
  8000. //OutsourcingIssueDoc√
  8001. //OutsourcingIssueDoNegative√
  8002. //OutsourcingReceiveDoc√
  8003. //OutsourcingReceiveDocNegative√
  8004. //PurchaseReceiveDoc√
  8005. //PurchaseReceiveDoctNegative√
  8006. //ReturnDoc√
  8007. //SalesDeliveryNotice√
  8008. //SalesShipmentDoc√
  8009. //SalesShipmentDocNegative√