纽威
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.

6842 lines
270 KiB

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