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

7730 lines
312 KiB

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