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

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