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.

758 lines
24 KiB

3 weeks ago
  1. using NFine.Application.WMS;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. using NFine.Code;
  10. using System.Data.SqlClient;
  11. using NFine.Data.Extensions;
  12. using System.Data.OleDb;
  13. using System.Configuration;
  14. using ICS.Application.Entity;
  15. using NFine.Application.DHAY;
  16. namespace NFine.Web.Areas.DHAY.Controllers
  17. {
  18. public class DHICSRCVIQCsController : ControllerBase
  19. {
  20. DHICSRCVIQCsApp App = new DHICSRCVIQCsApp();
  21. // GET: WMS/ICSRCVIQCs
  22. public ActionResult ICSRCVIQCs()
  23. {
  24. return View();
  25. }
  26. public ActionResult Rejection()
  27. {
  28. return View();
  29. }
  30. public ActionResult WWRejection()
  31. {
  32. return View();
  33. }
  34. public ActionResult ICSInspectionDetail()
  35. {
  36. return View();
  37. }
  38. public ActionResult ICSLookFiles()
  39. {
  40. return View();
  41. }
  42. public ActionResult ICSInspectionDetailNew()
  43. {
  44. return View();
  45. }
  46. public ActionResult ICSInspectionDetailDelete()
  47. {
  48. return View();
  49. }
  50. //采购
  51. [HttpGet]
  52. public ActionResult GetICSInspection(Pagination pagination, string queryJson,string FlagVersion)
  53. {
  54. DataTable ListData;
  55. if (FlagVersion=="1")
  56. {
  57. ListData = App.GetICSInspection(ref pagination, queryJson);
  58. }
  59. else if (FlagVersion == "2")
  60. {
  61. ListData = App.GetICSInspectionBatchCode(ref pagination, queryJson);
  62. }
  63. else if (FlagVersion == "3")
  64. {
  65. ListData = App.GetICSInspectionDocSequence(ref pagination, queryJson);
  66. }
  67. else
  68. {
  69. ListData = App.GetICSInspectionDoc(ref pagination, queryJson);
  70. }
  71. var JsonData = new
  72. {
  73. total = pagination.total,
  74. page = pagination.page,
  75. records = pagination.records,
  76. rows = ListData,
  77. };
  78. return Content(JsonData.ToJson());
  79. }
  80. [HttpGet]
  81. public ActionResult GetInspectionFile(Pagination pagination, string JYID, string queryJson)
  82. {
  83. DataTable ListData = App.GetInspectionFile(ref pagination, queryJson, JYID);
  84. var JsonData = new
  85. {
  86. total = pagination.total,
  87. page = pagination.page,
  88. records = pagination.records,
  89. rows = ListData,
  90. };
  91. return Content(JsonData.ToJson());
  92. }
  93. //委外
  94. [HttpGet]
  95. public ActionResult GetICSInspection2(Pagination pagination, string queryJson,string FlagVersion)
  96. {
  97. DataTable ListData;
  98. if (FlagVersion == "1")
  99. {
  100. ListData = App.GetICSInspection2(ref pagination, queryJson);
  101. }
  102. else if (FlagVersion == "2")
  103. {
  104. ListData = App.GetICSInspection2BatchCode(ref pagination, queryJson);
  105. }
  106. else if (FlagVersion == "3")
  107. {
  108. ListData = App.GetICSInspection2DocSequence(ref pagination, queryJson);
  109. }
  110. else
  111. {
  112. ListData = App.GetICSInspection2Doc(ref pagination, queryJson);
  113. }
  114. var JsonData = new
  115. {
  116. total = pagination.total,
  117. page = pagination.page,
  118. records = pagination.records,
  119. rows = ListData,
  120. };
  121. return Content(JsonData.ToJson());
  122. }
  123. //工单
  124. [HttpGet]
  125. public ActionResult GetICSInspection3(Pagination pagination, string queryJson,string FlagVersion)
  126. {
  127. DataTable ListData;
  128. if (FlagVersion == "1")
  129. {
  130. ListData = App.GetICSInspection3(ref pagination, queryJson);
  131. }
  132. else if (FlagVersion == "2")
  133. {
  134. ListData = App.GetICSInspection3BatchCode(ref pagination, queryJson);
  135. }
  136. else if (FlagVersion == "3")
  137. {
  138. ListData = App.GetICSInspection3DocSequence(ref pagination, queryJson);
  139. }
  140. else
  141. {
  142. ListData = App.GetICSInspection3Doc(ref pagination, queryJson);
  143. }
  144. var JsonData = new
  145. {
  146. total = pagination.total,
  147. page = pagination.page,
  148. records = pagination.records,
  149. rows = ListData,
  150. };
  151. return Content(JsonData.ToJson());
  152. }
  153. //其他入库
  154. [HttpGet]
  155. public ActionResult GetICSInspection4(Pagination pagination, string queryJson, string FlagVersion)
  156. {
  157. DataTable ListData;
  158. if (FlagVersion == "1")
  159. {
  160. ListData = App.GetICSInspection4(ref pagination, queryJson);
  161. }
  162. else if (FlagVersion == "2")
  163. {
  164. ListData = App.GetICSInspection4BatchCode(ref pagination, queryJson);
  165. }
  166. else if (FlagVersion == "3")
  167. {
  168. ListData = App.GetICSInspection4DocSequence(ref pagination, queryJson);
  169. }
  170. else
  171. {
  172. ListData = App.GetICSInspection4Doc(ref pagination, queryJson);
  173. }
  174. var JsonData = new
  175. {
  176. total = pagination.total,
  177. page = pagination.page,
  178. records = pagination.records,
  179. rows = ListData,
  180. };
  181. return Content(JsonData.ToJson());
  182. }
  183. //生产退料
  184. [HttpGet]
  185. public ActionResult GetICSInspection5(Pagination pagination, string queryJson, string FlagVersion)
  186. {
  187. DataTable ListData;
  188. if (FlagVersion == "1")
  189. {
  190. ListData = App.GetICSInspection5(ref pagination, queryJson);
  191. }
  192. else if (FlagVersion == "2")
  193. {
  194. ListData = App.GetICSInspection5BatchCode(ref pagination, queryJson);
  195. }
  196. else if (FlagVersion == "3")
  197. {
  198. ListData = App.GetICSInspection5DocSequence(ref pagination, queryJson);
  199. }
  200. else
  201. {
  202. ListData = App.GetICSInspection5Doc(ref pagination, queryJson);
  203. }
  204. var JsonData = new
  205. {
  206. total = pagination.total,
  207. page = pagination.page,
  208. records = pagination.records,
  209. rows = ListData,
  210. };
  211. return Content(JsonData.ToJson());
  212. }
  213. //委外退料
  214. [HttpGet]
  215. public ActionResult GetICSInspection6(Pagination pagination, string queryJson, string FlagVersion)
  216. {
  217. DataTable ListData;
  218. if (FlagVersion == "1")
  219. {
  220. ListData = App.GetICSInspection6(ref pagination, queryJson);
  221. }
  222. else if (FlagVersion == "2")
  223. {
  224. ListData = App.GetICSInspection6BatchCode(ref pagination, queryJson);
  225. }
  226. else if (FlagVersion == "3")
  227. {
  228. ListData = App.GetICSInspection6DocSequence(ref pagination, queryJson);
  229. }
  230. else
  231. {
  232. ListData = App.GetICSInspection6Doc(ref pagination, queryJson);
  233. }
  234. var JsonData = new
  235. {
  236. total = pagination.total,
  237. page = pagination.page,
  238. records = pagination.records,
  239. rows = ListData,
  240. };
  241. return Content(JsonData.ToJson());
  242. }
  243. //销售退货
  244. [HttpGet]
  245. public ActionResult GetICSInspection7(Pagination pagination, string queryJson, string FlagVersion)
  246. {
  247. DataTable ListData;
  248. if (FlagVersion == "1")
  249. {
  250. ListData = App.GetICSInspection7(ref pagination, queryJson);
  251. }
  252. else if (FlagVersion == "2")
  253. {
  254. ListData = App.GetICSInspection7BatchCode(ref pagination, queryJson);
  255. }
  256. else if (FlagVersion == "3")
  257. {
  258. ListData = App.GetICSInspection7DocSequence(ref pagination, queryJson);
  259. }
  260. else
  261. {
  262. ListData = App.GetICSInspection7Doc(ref pagination, queryJson);
  263. }
  264. var JsonData = new
  265. {
  266. total = pagination.total,
  267. page = pagination.page,
  268. records = pagination.records,
  269. rows = ListData,
  270. };
  271. return Content(JsonData.ToJson());
  272. }
  273. //不良原因
  274. [HttpGet]
  275. public ActionResult Select_ICSBadReason(string InvCode)
  276. {
  277. var data = App.Select_ICSBadReason(InvCode);
  278. return Content(data.ToJson());
  279. }
  280. //不良代码
  281. [HttpGet]
  282. public ActionResult GetSelectICSBadCode(string InvCode)
  283. {
  284. var data = App.GetSelectICSBadCode(InvCode);
  285. return Content(data.ToJson());
  286. }
  287. /// <summary>
  288. /// 创建检验表
  289. /// </summary>
  290. /// <param name="keyValue"></param>
  291. /// <returns></returns>
  292. [HttpPost]
  293. [HandlerAjaxOnly]
  294. public ActionResult CreateICSInspection(string keyValue, string ICSInspections)
  295. {
  296. string msg = App.CreateICSInspection(keyValue, ICSInspections);
  297. if (!string.IsNullOrEmpty(msg))
  298. {
  299. return Error(msg);
  300. }
  301. else
  302. {
  303. return Success("添加成功!");
  304. }
  305. }
  306. /// <summary>
  307. /// 在库检验保存检验结果
  308. /// </summary>
  309. /// <param name="keyValue"></param>
  310. /// <returns></returns>
  311. [HttpPost]
  312. [HandlerAjaxOnly]
  313. public ActionResult ICSWHLotInspection(string keyValue, string ICSInspections)
  314. {
  315. string msg = App.ICSWHLotInspection(keyValue, ICSInspections);
  316. if (!string.IsNullOrEmpty(msg))
  317. {
  318. return Error(msg);
  319. }
  320. else
  321. {
  322. return Success("检验结果保存成功!");
  323. }
  324. }
  325. /// <summary>
  326. /// 在库检验审核
  327. /// </summary>
  328. /// <param name="keyValue"></param>
  329. /// <returns></returns>
  330. [HttpPost]
  331. [HandlerAjaxOnly]
  332. public ActionResult ApproveWHLotInspection(string keyValue, string ICSInspections)
  333. {
  334. string msg = App.ApproveWHLotInspection(keyValue, ICSInspections);
  335. if (!string.IsNullOrEmpty(msg))
  336. {
  337. return Error(msg);
  338. }
  339. else
  340. {
  341. return Success("审核成功!");
  342. }
  343. }
  344. /// <summary>
  345. /// 在库检验复审
  346. /// </summary>
  347. /// <param name="keyValue"></param>
  348. /// <returns></returns>
  349. [HttpPost]
  350. [HandlerAjaxOnly]
  351. public ActionResult SecApproveWHLotInspection(string keyValue, string ICSInspections)
  352. {
  353. try
  354. {
  355. string msg = App.SecApproveWHLotInspection(keyValue, ICSInspections);
  356. if (!string.IsNullOrEmpty(msg))
  357. {
  358. return Error(msg);
  359. }
  360. else
  361. {
  362. return Success("审核成功!");
  363. }
  364. }
  365. catch (Exception ex)
  366. {
  367. return Error(ex.Message);
  368. }
  369. }
  370. //生成拒收单
  371. [HttpPost]
  372. [HandlerAjaxOnly]
  373. [ValidateAntiForgeryToken]
  374. public ActionResult CreateRejection(string keyValue, string Type)
  375. {
  376. string msg = "";
  377. if (Type == "1")
  378. {
  379. msg = App.CreateRejection(keyValue);
  380. }
  381. else if (Type == "8")
  382. {
  383. msg = App.CreateWLYRejection(keyValue);
  384. }
  385. else if (Type == "9")
  386. {
  387. msg = App.CreateWWWLYRejection(keyValue);
  388. }
  389. else
  390. {
  391. msg = App.CreateWWRejection(keyValue);
  392. }
  393. if (string.IsNullOrEmpty(msg))
  394. {
  395. return Success("操作成功!");
  396. }
  397. else
  398. {
  399. return Error("" + msg + "");
  400. }
  401. }
  402. /// <summary>
  403. /// 删除拒收单
  404. /// </summary>
  405. /// <returns></returns>
  406. [HttpPost]
  407. [HandlerAjaxOnly]
  408. [ValidateAntiForgeryToken]
  409. public ActionResult DelectRejection(string keyValue)
  410. {
  411. string msg = App.DelectRejection(keyValue);
  412. if (string.IsNullOrEmpty(msg))
  413. {
  414. return Success("删除成功!");
  415. }
  416. else
  417. {
  418. return Error(msg);
  419. }
  420. }
  421. [HttpPost]
  422. [HandlerAjaxOnly]
  423. [ValidateAntiForgeryToken]
  424. public ActionResult DelectWWRejection(string keyValue)
  425. {
  426. string msg = App.DelectWWRejection(keyValue);
  427. if (string.IsNullOrEmpty(msg))
  428. {
  429. return Success("删除成功!");
  430. }
  431. else
  432. {
  433. return Error(msg);
  434. }
  435. }
  436. [HttpGet]
  437. public ActionResult GetInventoryInspection(Pagination pagination, string InvCode, int SampleQuantity, string ResultINp)
  438. {
  439. DataTable ListData = App.GetInventoryInspection(ref pagination, InvCode, SampleQuantity, ResultINp);
  440. var JsonData = new
  441. {
  442. total = pagination.total,
  443. page = pagination.page,
  444. records = pagination.records,
  445. rows = ListData,
  446. };
  447. return Content(JsonData.ToJson());
  448. }
  449. [HttpPost]
  450. [HandlerAjaxOnly]
  451. public ActionResult SaveICSInspectionDetail(string ICSMTDOC, string InvCode, string ResultINp)
  452. {
  453. string msg = App.SaveICSInspectionDetail(ICSMTDOC, InvCode, ResultINp);
  454. if (!string.IsNullOrEmpty(msg))
  455. {
  456. return Error(msg);
  457. }
  458. else
  459. {
  460. return Success("保存成功!");
  461. }
  462. }
  463. /// <summary>
  464. /// 上传文件(检验信息)
  465. /// </summary>
  466. /// <param name="BidCode"></param>
  467. /// <param name="ID"></param>
  468. /// <returns></returns>
  469. [HttpPost]
  470. public ActionResult UpLoadFileImport(string ID, string DNCode)
  471. {
  472. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  473. string UploadfileName = "";
  474. string fileName = "";
  475. //获取上传的文件集合
  476. try
  477. {
  478. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  479. for (int i = 0; i < httpFile.Count; i++)
  480. {
  481. //获取送货单号
  482. //string STNO = Request.Form["STNO"].ToString();
  483. UploadfileName = Path.GetFileNameWithoutExtension(httpFile[i].FileName)
  484. + Path.GetExtension(httpFile[i].FileName);
  485. fileName = DNCode + Path.GetExtension(httpFile[i].FileName);
  486. string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\InspectionFile\\");
  487. if (!Directory.Exists(Paths))
  488. {
  489. Directory.CreateDirectory(Paths);
  490. }
  491. string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\InspectionFile\\" + UploadfileName);
  492. int iLen = httpFile[0].ContentLength;
  493. byte[] bData = new byte[iLen];
  494. httpFile[0].InputStream.Read(bData, 0, iLen);
  495. FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
  496. fs.Write(bData, 0, bData.Length);
  497. fs.Flush();
  498. fs.Close();
  499. fs.Dispose();
  500. App.InsertICSInspectionFile(ID, UploadfileName, fileName);
  501. }
  502. return Success("上传成功!");
  503. }
  504. catch (Exception ex)
  505. {
  506. return Error(ex.Message);
  507. }
  508. }
  509. //采购到货单检验
  510. [HttpGet]
  511. public ActionResult GetICSInspection8(Pagination pagination, string queryJson,string FlagVersion)
  512. {
  513. DataTable ListData;
  514. if (FlagVersion == "1")
  515. {
  516. ListData = App.GetICSInspection8(ref pagination, queryJson);
  517. }
  518. else if (FlagVersion == "2")
  519. {
  520. ListData = App.GetICSInspection8BatchCode(ref pagination, queryJson);
  521. }
  522. else if (FlagVersion == "3")
  523. {
  524. ListData = App.GetICSInspection8DocSequence(ref pagination, queryJson);
  525. }
  526. else
  527. {
  528. ListData = App.GetICSInspection8Doc(ref pagination, queryJson);
  529. }
  530. var JsonData = new
  531. {
  532. total = pagination.total,
  533. page = pagination.page,
  534. records = pagination.records,
  535. rows = ListData,
  536. };
  537. return Content(JsonData.ToJson());
  538. }
  539. //委外采购到货单检验
  540. [HttpGet]
  541. public ActionResult GetICSInspection9(Pagination pagination, string queryJson,string FlagVersion)
  542. {
  543. DataTable ListData;
  544. if (FlagVersion == "1")
  545. {
  546. ListData = App.GetICSInspection9(ref pagination, queryJson);
  547. }
  548. else if (FlagVersion == "2")
  549. {
  550. ListData = App.GetICSInspection9BatchCode(ref pagination, queryJson);
  551. }
  552. else if (FlagVersion == "3")
  553. {
  554. ListData = App.GetICSInspection9DocSequence(ref pagination, queryJson);
  555. }
  556. else
  557. {
  558. ListData = App.GetICSInspection9Doc(ref pagination, queryJson);
  559. }
  560. var JsonData = new
  561. {
  562. total = pagination.total,
  563. page = pagination.page,
  564. records = pagination.records,
  565. rows = ListData,
  566. };
  567. return Content(JsonData.ToJson());
  568. }
  569. //委外采购到货单检验
  570. [HttpGet]
  571. public ActionResult GetICSInspection10(Pagination pagination, string queryJson, string FlagVersion)
  572. {
  573. DataTable ListData;
  574. if (FlagVersion == "1")
  575. {
  576. ListData = App.GetICSInspection10(ref pagination, queryJson);
  577. }
  578. else if (FlagVersion == "2")
  579. {
  580. ListData = App.GetICSInspection10BatchCode(ref pagination, queryJson);
  581. }
  582. else if (FlagVersion == "3")
  583. {
  584. ListData = App.GetICSInspection10DocSequence(ref pagination, queryJson);
  585. }
  586. else
  587. {
  588. ListData = App.GetICSInspection10Doc(ref pagination, queryJson);
  589. }
  590. var JsonData = new
  591. {
  592. total = pagination.total,
  593. page = pagination.page,
  594. records = pagination.records,
  595. rows = ListData,
  596. };
  597. return Content(JsonData.ToJson());
  598. }
  599. //在库检验
  600. [HttpGet]
  601. public ActionResult GetICSInspection11(Pagination pagination, string queryJson,string FlagVersion)
  602. {
  603. try
  604. {
  605. DataTable ListData;
  606. if (FlagVersion == "1")
  607. {
  608. ListData = App.GetICSInspection11(ref pagination, queryJson);
  609. }
  610. else if (FlagVersion == "2")
  611. {
  612. ListData = App.GetICSInspection11BatchCode(ref pagination, queryJson);
  613. }
  614. else if (FlagVersion == "3")
  615. {
  616. ListData = App.GetICSInspection11DocSequence(ref pagination, queryJson);
  617. }
  618. else
  619. {
  620. ListData = App.GetICSInspection11Doc(ref pagination, queryJson);
  621. }
  622. var JsonData = new
  623. {
  624. total = pagination.total,
  625. page = pagination.page,
  626. records = pagination.records,
  627. rows = ListData,
  628. };
  629. return Content(JsonData.ToJson());
  630. }
  631. catch (Exception ex)
  632. {
  633. return Error(ex.Message);
  634. }
  635. }
  636. [HttpGet]
  637. public ActionResult GetInventoryInspectionNew(Pagination pagination, string InvCode, int SampleQuantity, string ResultINp, string JYID)
  638. {
  639. DataTable ListData = App.GetInventoryInspectionNew(ref pagination, InvCode, SampleQuantity, ResultINp, JYID);
  640. var JsonData = new
  641. {
  642. total = pagination.total,
  643. page = pagination.page,
  644. records = pagination.records,
  645. rows = ListData,
  646. };
  647. return Content(JsonData.ToJson());
  648. }
  649. [HttpGet]
  650. [HandlerAjaxOnly]
  651. public ActionResult GetRulesDetail(string LotNo)
  652. {
  653. DataTable ListData = App.GetRulesDetail(LotNo);
  654. var JsonData = new
  655. {
  656. rows = ListData,
  657. };
  658. return Content(JsonData.ToJson());
  659. }
  660. [HttpPost]
  661. [HandlerAjaxOnly]
  662. [ValidateInput(false)]
  663. public ActionResult SaveICSInspectionDetailNew(string InvCode, string JYID, string AllNumber, string YLOTQTY, string NLOTQTY, string WaiveQuantity, string BCCode, string BRCode, string ResultINp, string Lot, string Type, decimal CJQty, string ICSMTDOC)
  664. {
  665. string msg = App.SaveICSInspectionDetailNew(ICSMTDOC, InvCode, JYID, AllNumber, YLOTQTY, NLOTQTY, WaiveQuantity, BCCode, BRCode, ResultINp, Lot, Type, CJQty);
  666. if (!string.IsNullOrEmpty(msg))
  667. {
  668. return Error(msg);
  669. }
  670. else
  671. {
  672. return Success("保存成功!");
  673. }
  674. }
  675. [HttpPost]
  676. [HandlerAjaxOnly]
  677. public ActionResult UpdateICSInspectionDetailNew(string ICSMTDOC, string JYID, string ResultINp)
  678. {
  679. string msg = App.UpdateICSInspectionDetailNew(ICSMTDOC, JYID, ResultINp);
  680. if (!string.IsNullOrEmpty(msg))
  681. {
  682. return Error(msg);
  683. }
  684. else
  685. {
  686. return Success("保存成功!");
  687. }
  688. }
  689. /// <summary>
  690. /// 获取动态列
  691. /// </summary>
  692. /// <param name="BidCode"></param>
  693. /// <returns></returns>
  694. public ActionResult SelectSORRFQColumnName(string InvCode, string JYID)
  695. {
  696. var data = App.SelectSORRFQColumnName(InvCode, JYID);
  697. return Content(data.ToJson());
  698. }
  699. [HttpGet]
  700. [HandlerAjaxOnly]
  701. public ActionResult GetDeleteRulesDetail(string InvCode, string JYID)
  702. {
  703. DataTable ListData = App.GetDeleteRulesDetail(InvCode, JYID);
  704. var JsonData = new
  705. {
  706. rows = ListData,
  707. };
  708. return Content(JsonData.ToJson());
  709. }
  710. [HttpPost]
  711. public ActionResult DeleteICSInspection(string DetailID)
  712. {
  713. DetailID = DetailID.Substring(1, DetailID.Length - 2);
  714. string msg = App.DeleteICSInspection(DetailID);
  715. if (string.IsNullOrWhiteSpace(msg))
  716. {
  717. return Success("删除成功!");
  718. }
  719. else
  720. {
  721. return Error("删除失败");
  722. }
  723. }
  724. }
  725. }