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.

3014 lines
86 KiB

4 days ago
  1. 
  2. using System;
  3. using System.Data;
  4. using System.IO;
  5. using System.Web;
  6. using System.Web.Mvc;
  7. using NFine.Code;
  8. using System.Data.SqlClient;
  9. using NFine.Data.Extensions;
  10. using System.Collections.Generic;
  11. using Newtonsoft.Json;
  12. using NFine.Application;
  13. //using System.Web.Http;
  14. namespace NFine.Web.Areas.SRM.Controllers
  15. {
  16. public class BasicSettingsController : ControllerBase
  17. {
  18. BasicSettingsApp App = new BasicSettingsApp();
  19. /// <summary>
  20. /// 加载仓库
  21. /// </summary>
  22. /// <returns></returns>
  23. [HttpGet]
  24. public ActionResult Warehouse()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 加载库位
  30. /// </summary>
  31. /// <returns></returns>
  32. [HttpGet]
  33. public ActionResult ICSStackWMS()
  34. {
  35. return View();
  36. }
  37. /// <summary>
  38. /// 物料档案
  39. /// </summary>
  40. /// <returns></returns>
  41. [HttpGet]
  42. public ActionResult ICSINVENTORY()
  43. {
  44. return View();
  45. }
  46. /// <summary>
  47. /// 不良代码组
  48. /// </summary>
  49. /// <returns></returns>
  50. [HttpGet]
  51. public ActionResult ICSECG()
  52. {
  53. return View();
  54. }
  55. /// <summary>
  56. /// 加载仓库
  57. /// </summary>
  58. /// <returns></returns>
  59. [HttpGet]
  60. public ActionResult WarehouseApplyNegAdd()
  61. {
  62. return View();
  63. }
  64. /// <summary>
  65. /// 加载仓库
  66. /// </summary>
  67. /// <returns></returns>
  68. [HttpGet]
  69. public ActionResult WarehouseApplyNegUpdate()
  70. {
  71. return View();
  72. }
  73. /// <summary>
  74. ///
  75. /// </summary>
  76. /// <returns></returns>
  77. [HttpGet]
  78. public ActionResult ICSVenderAdd()
  79. {
  80. return View();
  81. }
  82. /// <summary>
  83. ///
  84. /// </summary>
  85. /// <returns></returns>
  86. [HttpGet]
  87. public ActionResult ICSDepartmentAdd()
  88. {
  89. return View();
  90. }
  91. /// <summary>
  92. /// 获取料品信息
  93. /// </summary>
  94. /// <param name="pagination"></param>
  95. /// <returns></returns>
  96. [HttpGet]
  97. public ActionResult GetICSWarehouseInfoId(string ID, Pagination pagination)
  98. {
  99. DataTable ListData = App.GetICSWarehouseInfoId(ID, ref pagination);
  100. var JsonData = new
  101. {
  102. total = pagination.total,
  103. page = pagination.page,
  104. records = pagination.records,
  105. rows = ListData,
  106. };
  107. return Content(JsonData.ToJson());
  108. }
  109. [HttpGet]
  110. public ActionResult ICSSDN()
  111. {
  112. return View();
  113. }
  114. /// <summary>
  115. /// 不良代码维护
  116. /// </summary>
  117. /// <returns></returns>
  118. [HttpGet]
  119. public ActionResult ICSBadCode()
  120. {
  121. return View();
  122. }
  123. /// <summary>
  124. /// 新增库位信息
  125. /// </summary>
  126. /// <returns></returns>
  127. [HttpGet]
  128. public ActionResult ICSStackWMSAdd()
  129. {
  130. return View();
  131. }
  132. [HttpGet]
  133. /// <summary>
  134. /// 标签模板维护
  135. /// </summary>
  136. /// <returns></returns>
  137. public ActionResult ICSLableManage()
  138. {
  139. return View();
  140. }
  141. public ActionResult ICSLableManageAdd()
  142. {
  143. return View();
  144. }
  145. /// <summary>
  146. /// 新增不良代码
  147. /// </summary>
  148. /// <returns></returns>
  149. public ActionResult ICSBadCodeAdd()
  150. {
  151. return View();
  152. }
  153. /// <summary>
  154. /// 类型维护
  155. /// </summary>
  156. /// <returns></returns>
  157. public ActionResult ICSTypeMaintain()
  158. {
  159. return View();
  160. }
  161. /// <summary>
  162. /// 站点维护
  163. /// </summary>
  164. /// <returns></returns>
  165. public ActionResult Sys_WorkPoint()
  166. {
  167. return View();
  168. }
  169. /// <summary>
  170. /// 新增站点
  171. /// </summary>
  172. /// <returns></returns>
  173. public ActionResult Sys_WorkPointAdd()
  174. {
  175. return View();
  176. }
  177. /// 新增类型
  178. /// </summary>
  179. /// <returns></returns>
  180. [HttpGet]
  181. public ActionResult ICSTypeMaintainAdd()
  182. {
  183. return View();
  184. }
  185. /// <summary>
  186. /// 配置参数维护
  187. /// </summary>
  188. /// <returns></returns>
  189. public ActionResult ICSConfiguration()
  190. {
  191. return View();
  192. }
  193. /// <summary>
  194. /// 启用配置
  195. /// </summary>
  196. /// <returns></returns>
  197. public ActionResult ICSExtensionEnable()
  198. {
  199. return View();
  200. }
  201. /// <summary>
  202. /// 单据启用配置
  203. /// </summary>
  204. /// <returns></returns>
  205. public ActionResult ICSColumnEnable()
  206. {
  207. return View();
  208. }
  209. /// <summary>
  210. /// 新增启用配置
  211. /// </summary>
  212. /// <returns></returns>
  213. public ActionResult ICSExtensionEnableAdd()
  214. {
  215. return View();
  216. }
  217. /// <summary>
  218. /// 新增单据启用配置
  219. /// </summary>
  220. /// <returns></returns>
  221. public ActionResult ICSColumnEnableAdd()
  222. {
  223. return View();
  224. }
  225. /// 新增类型
  226. /// </summary>
  227. /// <returns></returns>
  228. [HttpGet]
  229. public ActionResult ICSConfigurationAdd()
  230. {
  231. return View();
  232. }
  233. /// 不良原因组
  234. /// </summary>
  235. /// <returns></returns>
  236. [HttpGet]
  237. public ActionResult ICSBadReasonGroup()
  238. {
  239. return View();
  240. }
  241. /// 新增不良原因组
  242. /// </summary>
  243. /// <returns></returns>
  244. [HttpGet]
  245. public ActionResult ICSBadReasonGroupAdd()
  246. {
  247. return View();
  248. }
  249. /// 新增不良原因组
  250. /// </summary>
  251. /// <returns></returns>
  252. [HttpGet]
  253. public ActionResult ICSInventoryBadGroupAdd()
  254. {
  255. return View();
  256. }
  257. //包装容器绑定
  258. [HttpGet]
  259. public ActionResult ICSContainerBinding()
  260. {
  261. return View();
  262. }
  263. //维护条码过期时间
  264. [HttpGet]
  265. public ActionResult MaintainBarcodeTime()
  266. {
  267. return View();
  268. }
  269. //维护条码过期时间
  270. [HttpGet]
  271. public ActionResult MaintainBarcodeTimeUpdate()
  272. {
  273. return View();
  274. }
  275. //维护批次过期时间
  276. [HttpGet]
  277. public ActionResult MaintainBatchTime()
  278. {
  279. return View();
  280. }
  281. //维护批次过期时间
  282. [HttpGet]
  283. public ActionResult MaintainBatchTimeUpdate()
  284. {
  285. return View();
  286. }
  287. //多语言
  288. [HttpGet]
  289. public ActionResult ICSlanguage()
  290. {
  291. return View();
  292. }
  293. [HttpGet]
  294. public ActionResult ICSlanguageAdd()
  295. {
  296. return View();
  297. }
  298. [HttpGet]
  299. public ActionResult ICSInventoryInspectionRulesGroup()
  300. {
  301. return View();
  302. }
  303. [HttpGet]
  304. public ActionResult ICSInventoryInspectionRulesGroupAdd()
  305. {
  306. return View();
  307. }
  308. /// <summary>
  309. /// 检验规则
  310. /// </summary>
  311. /// <returns></returns>
  312. [HttpGet]
  313. public ActionResult ICSInspectionRulesGroup()
  314. {
  315. return View();
  316. }
  317. [HttpGet]
  318. public ActionResult ICSInspectionRulesListAdd()
  319. {
  320. return View();
  321. }
  322. [HttpGet]
  323. //不良代码
  324. public ActionResult GetICSBadCodeGroup(Pagination pagination, string queryJson)
  325. {
  326. DataTable ListData = App.GetICSBadCodeGroup(ref pagination, queryJson);
  327. var JsonData = new
  328. {
  329. total = pagination.total,
  330. page = pagination.page,
  331. records = pagination.records,
  332. rows = ListData,
  333. };
  334. return Content(JsonData.ToJson());
  335. }
  336. //不良原因()
  337. public ActionResult GetICSBadReasonGroup(Pagination pagination, string queryJson)
  338. {
  339. DataTable ListData = App.GetICSBadReasonGroup(ref pagination, queryJson);
  340. var JsonData = new
  341. {
  342. total = pagination.total,
  343. page = pagination.page,
  344. records = pagination.records,
  345. rows = ListData,
  346. };
  347. return Content(JsonData.ToJson());
  348. }
  349. //不良代码子表
  350. [HttpGet]
  351. [HandlerAjaxOnly]
  352. public ActionResult GetICSBadCodeGroupdetil(string ID, Pagination pagination)
  353. {
  354. DataTable ListData = App.GetICSBadCodeGroupdetil(ID, ref pagination);
  355. var JsonData = new
  356. {
  357. total = pagination.total,
  358. page = pagination.page,
  359. records = pagination.records,
  360. rows = ListData,
  361. };
  362. return Content(JsonData.ToJson());
  363. }
  364. [HttpGet]
  365. public ActionResult GetICSBadCodeGroupdetil2(string ID, Pagination pagination)
  366. {
  367. var data = App.GetICSBadCodeGroupdetil2(ID, ref pagination);
  368. var JsonData = new
  369. {
  370. total = pagination.total,
  371. page = pagination.page,
  372. records = pagination.records,
  373. rows = data,
  374. };
  375. return Content(JsonData.ToJson());
  376. }
  377. //不良原因子表
  378. [HttpGet]
  379. [HandlerAjaxOnly]
  380. public ActionResult GetICSBadReason(string BRGroupID, Pagination pagination)
  381. {
  382. DataTable ListData = App.GetICSBadReason(BRGroupID, ref pagination);
  383. var JsonData = new
  384. {
  385. total = pagination.total,
  386. page = pagination.page,
  387. records = pagination.records,
  388. rows = ListData,
  389. };
  390. return Content(JsonData.ToJson());
  391. }
  392. [HttpGet]
  393. public ActionResult GetICSBadReason2(string BID, Pagination pagination)
  394. {
  395. var ListData = App.GetICSBadReason2(BID, ref pagination);
  396. var JsonData = new
  397. {
  398. total = pagination.total,
  399. page = pagination.page,
  400. records = pagination.records,
  401. rows = ListData,
  402. };
  403. return Content(JsonData.ToJson());
  404. //return Content(data.ToJson());
  405. }
  406. [HttpGet]
  407. public ActionResult ICSInspectionGroup()
  408. {
  409. return View();
  410. }
  411. [HttpGet]
  412. public ActionResult ICSInspectionListAdd()
  413. {
  414. return View();
  415. }
  416. [HttpGet]
  417. public ActionResult ICSINVEBTORYAdd()
  418. {
  419. return View();
  420. }
  421. [HttpGet]
  422. public ActionResult ICSInventoryBatchEnable()
  423. {
  424. return View();
  425. }
  426. [HttpGet]
  427. public ActionResult ICSInventoryBatchEnableAdd()
  428. {
  429. return View();
  430. }
  431. [HttpGet]
  432. public ActionResult ICSInventoryBatchEnableUpadte()
  433. {
  434. return View();
  435. }
  436. [HttpGet]
  437. public ActionResult ICSInventoryLocation()
  438. {
  439. return View();
  440. }
  441. [HttpGet]
  442. public ActionResult ICSInventoryLocationAdd()
  443. {
  444. return View();
  445. }
  446. [HttpGet]
  447. public ActionResult ICSInventoryLocationUpdate()
  448. {
  449. return View();
  450. }
  451. [HttpGet]
  452. public ActionResult ICSContainer()
  453. {
  454. return View();
  455. }
  456. [HttpGet]
  457. public ActionResult ICSContainerAdd()
  458. {
  459. return View();
  460. }
  461. [HttpGet]
  462. public ActionResult ICSContainerLot()
  463. {
  464. return View();
  465. }
  466. [HttpGet]
  467. public ActionResult ICSContainerLotAdd()
  468. {
  469. return View();
  470. }
  471. [HttpGet]
  472. public ActionResult ICSInventoryBadGroup()
  473. {
  474. return View();
  475. }
  476. [HttpGet]
  477. public ActionResult ICSInventoryBadGroupUpdate()
  478. {
  479. return View();
  480. }
  481. [HttpGet]
  482. public ActionResult ICSLabelTemplate()
  483. {
  484. return View();
  485. }
  486. [HttpGet]
  487. public ActionResult ICSLabelTemplateAdd()
  488. {
  489. return View();
  490. }
  491. [HttpGet]
  492. public ActionResult ICSContainerLotBinding()
  493. {
  494. return View();
  495. }
  496. //料品检验项目组
  497. [HttpGet]
  498. public ActionResult ICSInventoryInspectionGroup()
  499. {
  500. return View();
  501. }
  502. [HttpGet]
  503. public ActionResult ICSInventoryInspectionGroupAdd()
  504. {
  505. return View();
  506. }
  507. [HttpGet]
  508. public ActionResult ICSSearchInventory()
  509. {
  510. return View();
  511. }
  512. [HttpGet]
  513. public ActionResult Sys_WorkPointClone()
  514. {
  515. return View();
  516. }
  517. public ActionResult CleanUpTableData()
  518. {
  519. return View();
  520. }
  521. /// <summary>
  522. /// 删除库位
  523. /// </summary>
  524. /// <returns></returns>
  525. [HttpPost]
  526. [HandlerAjaxOnly]
  527. [ValidateAntiForgeryToken]
  528. public ActionResult DeleteStack(string keyValue)
  529. {
  530. string msg = App.DeleteStack(keyValue);
  531. if (string.IsNullOrEmpty(msg))
  532. {
  533. return Success("删除成功!");
  534. }
  535. else
  536. {
  537. return Error(msg);
  538. //throw new Exception(msg);
  539. }
  540. }
  541. /// <summary>
  542. /// 删除不良原因
  543. /// </summary>
  544. /// <returns></returns>
  545. [HttpPost]
  546. [HandlerAjaxOnly]
  547. [ValidateAntiForgeryToken]
  548. public ActionResult DeleteBadCode(string keyValue)
  549. {
  550. string msg = App.DeleteBadCode(keyValue);
  551. if (string.IsNullOrEmpty(msg))
  552. {
  553. return Success("删除成功!");
  554. }
  555. else
  556. {
  557. return Error(msg);
  558. }
  559. }
  560. [HttpPost]
  561. [HandlerAjaxOnly]
  562. public ActionResult InsertStack(string keyValue)
  563. {
  564. string msg = App.InsertStack(keyValue);
  565. if (!string.IsNullOrEmpty(msg))
  566. {
  567. return Error(msg);
  568. }
  569. else
  570. {
  571. return Success("添加成功!");
  572. }
  573. }
  574. [HttpPost]
  575. [HandlerAjaxOnly]
  576. public ActionResult InsertBadCode(string keyValue)
  577. {
  578. string msg = App.InsertBadCode(keyValue);
  579. try
  580. {
  581. if (!string.IsNullOrEmpty(msg))
  582. {
  583. return Error(msg);
  584. }
  585. else
  586. {
  587. return Success("添加成功!");
  588. }
  589. }
  590. catch (Exception ex)
  591. {
  592. return Error(ex.Message);
  593. }
  594. }
  595. [HttpPost]
  596. [HandlerAjaxOnly]
  597. public ActionResult UpdateBadCode(string keyValue)
  598. {
  599. string msg = App.UpdateBadCode(keyValue);
  600. if (!string.IsNullOrEmpty(msg))
  601. {
  602. return Error(msg);
  603. }
  604. else
  605. {
  606. return Success("修改成功!");
  607. }
  608. }
  609. [HttpPost]
  610. [HandlerAjaxOnly]
  611. public ActionResult UpdateStack(string keyValue)
  612. {
  613. string msg = App.UpdateStack(keyValue);
  614. if (!string.IsNullOrEmpty(msg))
  615. {
  616. return Error(msg);
  617. }
  618. else
  619. {
  620. return Success("修改成功!");
  621. }
  622. }
  623. /// <summary>
  624. /// 获取库位信息
  625. /// </summary>
  626. /// <returns></returns>
  627. public ActionResult GetWarehouse()
  628. {
  629. DataTable dt = App.GetWarehouse();
  630. return Content(dt.ToJson());
  631. }
  632. /// <summary>
  633. /// 新增类型
  634. /// </summary>
  635. /// <param name="keyValue"></param>
  636. /// <returns></returns>
  637. [HttpPost]
  638. [HandlerAjaxOnly]
  639. public ActionResult InsertICSType(string keyValue)
  640. {
  641. string msg = App.InsertICSType(keyValue);
  642. if (!string.IsNullOrEmpty(msg))
  643. {
  644. return Error(msg);
  645. }
  646. else
  647. {
  648. return Success("添加成功!");
  649. }
  650. }
  651. /// <summary>
  652. /// 修改类型
  653. /// </summary>
  654. /// <param name="keyValue"></param>
  655. /// <returns></returns>
  656. [HttpPost]
  657. [HandlerAjaxOnly]
  658. public ActionResult UpdateICSType(string keyValue)
  659. {
  660. string msg = App.UpdateICSType(keyValue);
  661. if (!string.IsNullOrEmpty(msg))
  662. {
  663. return Error(msg);
  664. }
  665. else
  666. {
  667. return Success("修改成功!");
  668. }
  669. }
  670. /// <summary>
  671. /// 删除类型
  672. /// </summary>
  673. /// <returns></returns>
  674. [HttpPost]
  675. [HandlerAjaxOnly]
  676. [ValidateAntiForgeryToken]
  677. public ActionResult DeleteICSType(string keyValue)
  678. {
  679. string msg = App.DeleteICSType(keyValue);
  680. if (string.IsNullOrEmpty(msg))
  681. {
  682. return Success("删除成功!");
  683. }
  684. else
  685. {
  686. return Error(msg);
  687. }
  688. }
  689. /// <summary>
  690. /// 修改配置参数
  691. /// </summary>
  692. /// <param name="keyValue"></param>
  693. /// <returns></returns>
  694. [HttpPost]
  695. [HandlerAjaxOnly]
  696. public ActionResult UpdateICSConfiguration(string keyValue)
  697. {
  698. string msg = App.UpdateICSConfiguration(keyValue);
  699. if (!string.IsNullOrEmpty(msg))
  700. {
  701. return Error(msg);
  702. }
  703. else
  704. {
  705. return Success("修改成功!");
  706. }
  707. }
  708. /// <summary>
  709. /// 新增参数配置
  710. /// </summary>
  711. /// <param name="keyValue"></param>
  712. /// <returns></returns>
  713. [HttpPost]
  714. [HandlerAjaxOnly]
  715. public ActionResult InsertICSConfiguration(string keyValue)
  716. {
  717. string msg = App.InsertICSConfiguration(keyValue);
  718. if (!string.IsNullOrEmpty(msg))
  719. {
  720. return Error(msg);
  721. }
  722. else
  723. {
  724. return Success("添加成功!");
  725. }
  726. }
  727. /// <summary>
  728. /// 删除参数配置
  729. /// </summary>
  730. /// <returns></returns>
  731. [HttpPost]
  732. [HandlerAjaxOnly]
  733. [ValidateAntiForgeryToken]
  734. public ActionResult DeleteICSConfiguration(string keyValue)
  735. {
  736. string msg = App.DeleteICSConfiguration(keyValue);
  737. if (string.IsNullOrEmpty(msg))
  738. {
  739. return Success("删除成功!");
  740. }
  741. else
  742. {
  743. return Error(msg);
  744. }
  745. }
  746. /// <summary>
  747. /// 修改启用配置
  748. /// </summary>
  749. /// <param name="keyValue"></param>
  750. /// <returns></returns>
  751. [HttpPost]
  752. [HandlerAjaxOnly]
  753. public ActionResult UpdateICSExtensionEnable(string keyValue)
  754. {
  755. string msg = App.UpdateICSExtensionEnable(keyValue);
  756. if (!string.IsNullOrEmpty(msg))
  757. {
  758. return Error(msg);
  759. }
  760. else
  761. {
  762. return Success("修改成功!");
  763. }
  764. }
  765. /// <summary>
  766. /// 修改启用配置
  767. /// </summary>
  768. /// <param name="keyValue"></param>
  769. /// <returns></returns>
  770. [HttpPost]
  771. [HandlerAjaxOnly]
  772. public ActionResult UpdateICSColumnEnable(string keyValue)
  773. {
  774. string msg = App.UpdateICSColumnEnable(keyValue);
  775. if (!string.IsNullOrEmpty(msg))
  776. {
  777. return Error(msg);
  778. }
  779. else
  780. {
  781. return Success("修改成功!");
  782. }
  783. }
  784. /// <summary>
  785. /// 新增启用配置
  786. /// </summary>
  787. /// <param name="keyValue"></param>
  788. /// <returns></returns>
  789. [HttpPost]
  790. [HandlerAjaxOnly]
  791. public ActionResult InsertICSExtensionEnable(string keyValue)
  792. {
  793. string msg = App.InsertICSExtensionEnable(keyValue);
  794. if (!string.IsNullOrEmpty(msg))
  795. {
  796. return Error(msg);
  797. }
  798. else
  799. {
  800. return Success("添加成功!");
  801. }
  802. }
  803. /// <summary>
  804. /// 新增单据启用配置
  805. /// </summary>
  806. /// <param name="keyValue"></param>
  807. /// <returns></returns>
  808. [HttpPost]
  809. [HandlerAjaxOnly]
  810. public ActionResult InsertICSColumnEnable(string keyValue)
  811. {
  812. string msg = App.InsertICSColumnEnable(keyValue);
  813. if (!string.IsNullOrEmpty(msg))
  814. {
  815. return Error(msg);
  816. }
  817. else
  818. {
  819. return Success("添加成功!");
  820. }
  821. }
  822. /// <summary>
  823. /// 删除启用配置
  824. /// </summary>
  825. /// <returns></returns>
  826. [HttpPost]
  827. [HandlerAjaxOnly]
  828. [ValidateAntiForgeryToken]
  829. public ActionResult DeleteICSExtensionEnable(string keyValue)
  830. {
  831. string msg = App.DeleteICSExtensionEnable(keyValue);
  832. if (string.IsNullOrEmpty(msg))
  833. {
  834. return Success("删除成功!");
  835. }
  836. else
  837. {
  838. return Error(msg);
  839. }
  840. }
  841. /// <summary>
  842. /// 删除单据启用配置
  843. /// </summary>
  844. /// <returns></returns>
  845. [HttpPost]
  846. [HandlerAjaxOnly]
  847. [ValidateAntiForgeryToken]
  848. public ActionResult DeleteICSColumnEnable(string keyValue)
  849. {
  850. string msg = App.DeleteICSColumnEnable(keyValue);
  851. if (string.IsNullOrEmpty(msg))
  852. {
  853. return Success("删除成功!");
  854. }
  855. else
  856. {
  857. return Error(msg);
  858. }
  859. }
  860. [HttpGet]
  861. public ActionResult DeleteBCItem(string ID)
  862. {
  863. try
  864. {
  865. App.DeleteBCItem(ID);
  866. return Success("删除成功!");
  867. }
  868. catch (Exception ex)
  869. {
  870. return Error(ex.Message);
  871. }
  872. }
  873. [HttpGet]
  874. public ActionResult DeleteINvItem(string ID)
  875. {
  876. try
  877. {
  878. App.DeleteItem(ID);
  879. return Success("删除成功!");
  880. }
  881. catch (Exception ex)
  882. {
  883. return Error(ex.Message);
  884. }
  885. }
  886. /// <summary>
  887. /// 删除不良代码组
  888. /// </summary>
  889. /// <returns></returns>
  890. [HttpPost]
  891. [HandlerAjaxOnly]
  892. [ValidateAntiForgeryToken]
  893. public ActionResult DeleteICSBadCodeGroup(string keyValue)
  894. {
  895. string msg = App.DeleteICSBadCodeGroup(keyValue);
  896. if (string.IsNullOrEmpty(msg))
  897. {
  898. return Success("删除成功!");
  899. }
  900. else
  901. {
  902. return Error(msg);
  903. }
  904. }
  905. /// <summary>
  906. /// 删除不良原因组
  907. /// </summary>
  908. /// <returns></returns>
  909. [HttpPost]
  910. [HandlerAjaxOnly]
  911. [ValidateAntiForgeryToken]
  912. public ActionResult DeleteICSBadReasonGroup(string keyValue)
  913. {
  914. string msg = App.DeleteICSBadReasonGroup(keyValue);
  915. if (string.IsNullOrEmpty(msg))
  916. {
  917. return Success("删除成功!");
  918. }
  919. else
  920. {
  921. return Error(msg);
  922. }
  923. }
  924. [HttpGet]
  925. public ActionResult GetICSInspectionGroup(Pagination pagination, string queryJson)
  926. {
  927. DataTable ListData = App.GetICSInspectionGroup(ref pagination, queryJson);
  928. var JsonData = new
  929. {
  930. total = pagination.total,
  931. page = pagination.page,
  932. records = pagination.records,
  933. rows = ListData,
  934. };
  935. return Content(JsonData.ToJson());
  936. }
  937. [HttpGet]
  938. [HandlerAjaxOnly]
  939. public ActionResult ICSInspectionList(string GroupCode, Pagination pagination)
  940. {
  941. DataTable ListData = App.ICSInspectionList(GroupCode, ref pagination);
  942. var JsonData = new
  943. {
  944. total = pagination.total,
  945. page = pagination.page,
  946. records = pagination.records,
  947. rows = ListData,
  948. };
  949. return Content(JsonData.ToJson());
  950. }
  951. //删除自动表
  952. [HttpGet]
  953. public ActionResult DeleteList(string ID)
  954. {
  955. try
  956. {
  957. App.DeleteList(ID);
  958. return Success("删除成功!");
  959. }
  960. catch (Exception ex)
  961. {
  962. return Error(ex.Message);
  963. }
  964. }
  965. /// <summary>
  966. /// 动态子表修改加载页面
  967. /// </summary>
  968. /// <param name="GroupCode"></param>
  969. /// <returns></returns>
  970. [HttpGet]
  971. public ActionResult ICSInspectionList2(string GroupCode)
  972. {
  973. var data = App.ICSInspectionList2(GroupCode);
  974. return Content(data.ToJson());
  975. }
  976. /// <summary>
  977. /// 删除不良原因组
  978. /// </summary>
  979. /// <returns></returns>
  980. [HttpPost]
  981. [HandlerAjaxOnly]
  982. [ValidateAntiForgeryToken]
  983. public ActionResult DeleteICSInspectionGroup(string keyValue)
  984. {
  985. string msg = App.DeleteICSInspectionGroup(keyValue);
  986. if (string.IsNullOrEmpty(msg))
  987. {
  988. return Success("删除成功!");
  989. }
  990. else
  991. {
  992. return Error(msg);
  993. }
  994. }
  995. /// <summary>
  996. /// 新增料品属性
  997. /// </summary>
  998. /// <param name="keyValue"></param>
  999. /// <returns></returns>
  1000. [HttpPost]
  1001. [HandlerAjaxOnly]
  1002. public ActionResult InsertICSInventory(string keyValue)
  1003. {
  1004. string msg = App.InsertICSInventory(keyValue);
  1005. if (!string.IsNullOrEmpty(msg))
  1006. {
  1007. return Error(msg);
  1008. }
  1009. else
  1010. {
  1011. return Success("添加成功!");
  1012. }
  1013. }
  1014. /// <summary>
  1015. /// 修改料品属性
  1016. /// </summary>
  1017. /// <param name="keyValue"></param>
  1018. /// <returns></returns>
  1019. [HttpPost]
  1020. [HandlerAjaxOnly]
  1021. public ActionResult UpdateICSInventory(string keyValue)
  1022. {
  1023. string msg = App.UpdateICSInventory(keyValue);
  1024. if (!string.IsNullOrEmpty(msg))
  1025. {
  1026. return Error(msg);
  1027. }
  1028. else
  1029. {
  1030. return Success("修改成功!");
  1031. }
  1032. }
  1033. /// <summary>
  1034. /// 新增部门
  1035. /// </summary>
  1036. /// <param name="keyValue"></param>
  1037. /// <returns></returns>
  1038. [HttpPost]
  1039. [HandlerAjaxOnly]
  1040. public ActionResult InsertICSDeptment(string keyValue)
  1041. {
  1042. string msg = App.InsertICSDeptment(keyValue);
  1043. if (!string.IsNullOrEmpty(msg))
  1044. {
  1045. return Error(msg);
  1046. }
  1047. else
  1048. {
  1049. return Success("添加成功!");
  1050. }
  1051. }
  1052. /// <summary>
  1053. /// 修改部门
  1054. /// </summary>
  1055. /// <param name="keyValue"></param>
  1056. /// <returns></returns>
  1057. [HttpPost]
  1058. [HandlerAjaxOnly]
  1059. public ActionResult UpdateICSDeptment(string keyValue)
  1060. {
  1061. string msg = App.UpdateICSDeptment(keyValue);
  1062. if (!string.IsNullOrEmpty(msg))
  1063. {
  1064. return Error(msg);
  1065. }
  1066. else
  1067. {
  1068. return Success("修改成功!");
  1069. }
  1070. }
  1071. /// <summary>
  1072. /// 删除部门
  1073. /// </summary>
  1074. /// <returns></returns>
  1075. [HttpPost]
  1076. [HandlerAjaxOnly]
  1077. [ValidateAntiForgeryToken]
  1078. public ActionResult DeleteICSDeptment(string keyValue)
  1079. {
  1080. string msg = App.DeleteICSDeptment(keyValue);
  1081. if (string.IsNullOrEmpty(msg))
  1082. {
  1083. return Success("删除成功!");
  1084. }
  1085. else
  1086. {
  1087. return Error(msg);
  1088. }
  1089. }
  1090. /// <summary>
  1091. /// 修改PDA版本
  1092. /// </summary>
  1093. /// <param name="keyValue"></param>
  1094. /// <returns></returns>
  1095. [HttpPost]
  1096. [HandlerAjaxOnly]
  1097. public ActionResult UpdatePDAVersion(string keyValue)
  1098. {
  1099. string msg = App.UpdatePDAVersion(keyValue);
  1100. if (!string.IsNullOrEmpty(msg))
  1101. {
  1102. return Error(msg);
  1103. }
  1104. else
  1105. {
  1106. return Success("修改成功!");
  1107. }
  1108. }
  1109. /// <summary>
  1110. /// 获取料品属性修改文本框值
  1111. /// </summary>
  1112. /// <param name="POCode"></param>
  1113. /// <param name="PORow"></param>
  1114. /// <returns></returns>
  1115. [HttpPost]
  1116. [HandlerAjaxOnly]
  1117. public ActionResult GetInputValue(string ID)
  1118. {
  1119. DataTable ListData = App.GetInputValue(ID);
  1120. var JsonData = new
  1121. {
  1122. rows = ListData,
  1123. };
  1124. return Content(JsonData.ToJson());
  1125. }
  1126. /// <summary>
  1127. /// 获取部门修改文本框值
  1128. /// </summary>
  1129. [HttpPost]
  1130. [HandlerAjaxOnly]
  1131. public ActionResult GetDepInputValue(string ID)
  1132. {
  1133. DataTable ListData = App.GetDepInputValue(ID);
  1134. var JsonData = new
  1135. {
  1136. rows = ListData,
  1137. };
  1138. return Content(JsonData.ToJson());
  1139. }
  1140. /// <summary>
  1141. /// 删除料品属性
  1142. /// </summary>
  1143. /// <returns></returns>
  1144. [HttpPost]
  1145. [HandlerAjaxOnly]
  1146. [ValidateAntiForgeryToken]
  1147. public ActionResult DeleteICSInventory(string keyValue)
  1148. {
  1149. string msg = App.DeleteICSInventory(keyValue);
  1150. if (string.IsNullOrEmpty(msg))
  1151. {
  1152. return Success("删除成功!");
  1153. }
  1154. else
  1155. {
  1156. return Error(msg);
  1157. }
  1158. }
  1159. /// <summary>
  1160. /// 获取料品信息
  1161. /// </summary>
  1162. /// <param name="pagination"></param>
  1163. /// <returns></returns>
  1164. [HttpGet]
  1165. public ActionResult GetICSInventoryInfo(string queryJson, Pagination pagination)
  1166. {
  1167. DataTable ListData = App.GetICSInventoryInfo(queryJson, ref pagination);
  1168. var JsonData = new
  1169. {
  1170. total = pagination.total,
  1171. page = pagination.page,
  1172. records = pagination.records,
  1173. rows = ListData,
  1174. };
  1175. return Content(JsonData.ToJson());
  1176. }
  1177. /// 获取仓库信息
  1178. /// </summary>
  1179. /// <param name="pagination"></param>
  1180. /// <returns></returns>
  1181. [HttpGet]
  1182. public ActionResult GetICSWarehouseInfo(string queryJson, Pagination pagination)
  1183. {
  1184. DataTable ListData = App.GetICSWarehouseInfo(queryJson, ref pagination);
  1185. var JsonData = new
  1186. {
  1187. total = pagination.total,
  1188. page = pagination.page,
  1189. records = pagination.records,
  1190. rows = ListData,
  1191. };
  1192. return Content(JsonData.ToJson());
  1193. }
  1194. /// <summary>
  1195. /// 新增料品仓库批次
  1196. /// </summary>
  1197. /// <param name="keyValue"></param>
  1198. /// <returns></returns>
  1199. [HttpPost]
  1200. [HandlerAjaxOnly]
  1201. public ActionResult InsertICSInventoryBatchEnable(string keyValue, string keyValue2)
  1202. {
  1203. string msg = App.InsertICSInventoryBatchEnable(keyValue, keyValue2);
  1204. if (!string.IsNullOrEmpty(msg))
  1205. {
  1206. return Error(msg);
  1207. }
  1208. else
  1209. {
  1210. return Success("添加成功!");
  1211. }
  1212. }
  1213. /// <summary>
  1214. /// 修改料品仓库批次关系
  1215. /// </summary>
  1216. /// <param name="keyValue"></param>
  1217. /// <returns></returns>
  1218. [HttpPost]
  1219. [HandlerAjaxOnly]
  1220. public ActionResult UpdateICSInventoryBatchEnable(string keyValue)
  1221. {
  1222. string msg = App.UpdateICSInventoryBatchEnable(keyValue);
  1223. if (!string.IsNullOrEmpty(msg))
  1224. {
  1225. return Error(msg);
  1226. }
  1227. else
  1228. {
  1229. return Success("修改成功!");
  1230. }
  1231. }
  1232. /// <summary>
  1233. /// 删除料品仓库批次关系
  1234. /// </summary>
  1235. /// <returns></returns>
  1236. [HttpPost]
  1237. [HandlerAjaxOnly]
  1238. [ValidateAntiForgeryToken]
  1239. public ActionResult DeleteICSInventoryBatchEnable(string keyValue)
  1240. {
  1241. string msg = App.DeleteICSInventoryBatchEnable(keyValue);
  1242. if (string.IsNullOrEmpty(msg))
  1243. {
  1244. return Success("删除成功!");
  1245. }
  1246. else
  1247. {
  1248. return Error(msg);
  1249. }
  1250. }
  1251. /// 获取库位信息
  1252. /// </summary>
  1253. /// <param name="pagination"></param>
  1254. /// <returns></returns>
  1255. [HttpGet]
  1256. public ActionResult GetICSLocation(string queryJson, Pagination pagination)
  1257. {
  1258. DataTable ListData = App.GetICSLocation(queryJson, ref pagination);
  1259. var JsonData = new
  1260. {
  1261. total = pagination.total,
  1262. page = pagination.page,
  1263. records = pagination.records,
  1264. rows = ListData,
  1265. };
  1266. return Content(JsonData.ToJson());
  1267. }
  1268. /// <summary>
  1269. /// 新增料品库位绑定关系
  1270. /// </summary>
  1271. /// <param name="keyValue"></param>
  1272. /// <returns></returns>
  1273. [HttpPost]
  1274. [HandlerAjaxOnly]
  1275. public ActionResult InsertICSInventoryLocation(string keyValue, string keyValue2)
  1276. {
  1277. string msg = App.InsertICSInventoryLocation(keyValue, keyValue2);
  1278. if (!string.IsNullOrEmpty(msg))
  1279. {
  1280. return Error(msg);
  1281. }
  1282. else
  1283. {
  1284. return Success("添加成功!");
  1285. }
  1286. }
  1287. /// <summary>
  1288. /// 修改料品库位绑定关系
  1289. /// </summary>
  1290. /// <param name="keyValue"></param>
  1291. /// <returns></returns>
  1292. [HttpPost]
  1293. [HandlerAjaxOnly]
  1294. public ActionResult UpdateICSInventoryLocation(string keyValue)
  1295. {
  1296. string msg = App.UpdateICSInventoryLocation(keyValue);
  1297. if (!string.IsNullOrEmpty(msg))
  1298. {
  1299. return Error(msg);
  1300. }
  1301. else
  1302. {
  1303. return Success("修改成功!");
  1304. }
  1305. }
  1306. /// <summary>
  1307. /// 删除料品仓库批次关系
  1308. /// </summary>
  1309. /// <returns></returns>
  1310. [HttpPost]
  1311. [HandlerAjaxOnly]
  1312. [ValidateAntiForgeryToken]
  1313. public ActionResult DeleteICSInventoryLocation(string keyValue)
  1314. {
  1315. string msg = App.DeleteICSInventoryLocation(keyValue);
  1316. if (string.IsNullOrEmpty(msg))
  1317. {
  1318. return Success("删除成功!");
  1319. }
  1320. else
  1321. {
  1322. return Error(msg);
  1323. }
  1324. }
  1325. /// <summary>
  1326. /// 新增包装、容器
  1327. /// </summary>
  1328. /// <param name="keyValue"></param>
  1329. /// <returns></returns>
  1330. [HttpPost]
  1331. [HandlerAjaxOnly]
  1332. public ActionResult InsertICSContainer(string keyValue)
  1333. {
  1334. string msg = App.InsertICSContainer(keyValue);
  1335. if (!string.IsNullOrEmpty(msg))
  1336. {
  1337. return Error(msg);
  1338. }
  1339. else
  1340. {
  1341. return Success("添加成功!");
  1342. }
  1343. }
  1344. /// <summary>
  1345. /// 修改包装、容器
  1346. /// </summary>
  1347. /// <param name="keyValue"></param>
  1348. /// <returns></returns>
  1349. [HttpPost]
  1350. [HandlerAjaxOnly]
  1351. public ActionResult UpdateICSContainer(string keyValue)
  1352. {
  1353. string msg = App.UpdateICSContainer(keyValue);
  1354. if (!string.IsNullOrEmpty(msg))
  1355. {
  1356. return Error(msg);
  1357. }
  1358. else
  1359. {
  1360. return Success("修改成功!");
  1361. }
  1362. }
  1363. /// <summary>
  1364. /// 新增包装、容器
  1365. /// </summary>
  1366. /// <param name="keyValue"></param>
  1367. /// <returns></returns>
  1368. [HttpPost]
  1369. [HandlerAjaxOnly]
  1370. public ActionResult InsertICSContainerLot(string keyValue)
  1371. {
  1372. string msg = App.InsertICSContainerLot(keyValue);
  1373. if (!string.IsNullOrEmpty(msg))
  1374. {
  1375. return Error(msg);
  1376. }
  1377. else
  1378. {
  1379. return Success("添加成功!");
  1380. }
  1381. }
  1382. /// <summary>
  1383. /// 修改包装、容器
  1384. /// </summary>
  1385. /// <param name="keyValue"></param>
  1386. /// <returns></returns>
  1387. [HttpPost]
  1388. [HandlerAjaxOnly]
  1389. public ActionResult UpdateICSContainerLot(string keyValue)
  1390. {
  1391. string msg = App.UpdateICSContainerLot(keyValue);
  1392. if (!string.IsNullOrEmpty(msg))
  1393. {
  1394. return Error(msg);
  1395. }
  1396. else
  1397. {
  1398. return Success("修改成功!");
  1399. }
  1400. }
  1401. /// <summary>
  1402. /// 获取物料信息
  1403. /// </summary>
  1404. /// <returns></returns>
  1405. public ActionResult GetInvCode()
  1406. {
  1407. DataTable dt = App.GetInvCode();
  1408. return Content(dt.ToJson());
  1409. }
  1410. /// <summary>
  1411. /// 获取不良代码信息
  1412. /// </summary>
  1413. /// <returns></returns>
  1414. public ActionResult GetBCGroup()
  1415. {
  1416. DataTable dt = App.GetBCGroup();
  1417. return Content(dt.ToJson());
  1418. }
  1419. /// <summary>
  1420. /// 获取不良原因信息
  1421. /// </summary>
  1422. /// <returns></returns>
  1423. public ActionResult BRGroupID()
  1424. {
  1425. DataTable dt = App.BRGroupID();
  1426. return Content(dt.ToJson());
  1427. }
  1428. [HttpPost]
  1429. [HandlerAjaxOnly]
  1430. public ActionResult InsertInventoryBadGroup(string keyValue)
  1431. {
  1432. string msg = App.InsertInventoryBadGroup(keyValue);
  1433. if (!string.IsNullOrEmpty(msg))
  1434. {
  1435. return Error(msg);
  1436. }
  1437. else
  1438. {
  1439. return Success("添加成功!");
  1440. }
  1441. }
  1442. [HttpPost]
  1443. [HandlerAjaxOnly]
  1444. public ActionResult UpdateInventoryBadGroup(string keyValue)
  1445. {
  1446. string msg = App.UpdateInventoryBadGroup(keyValue);
  1447. if (!string.IsNullOrEmpty(msg))
  1448. {
  1449. return Error(msg);
  1450. }
  1451. else
  1452. {
  1453. return Success("修改成功!");
  1454. }
  1455. }
  1456. /// <summary>
  1457. /// 删除料品不良信息
  1458. /// </summary>
  1459. /// <returns></returns>
  1460. [HttpPost]
  1461. [HandlerAjaxOnly]
  1462. [ValidateAntiForgeryToken]
  1463. public ActionResult DeleteInventoryBadGroup(string keyValue)
  1464. {
  1465. string msg = App.DeleteInventoryBadGroup(keyValue);
  1466. if (string.IsNullOrEmpty(msg))
  1467. {
  1468. return Success("删除成功!");
  1469. }
  1470. else
  1471. {
  1472. return Error(msg);
  1473. }
  1474. }
  1475. #region 打印
  1476. /// <summary>
  1477. /// 打印数据参数:服务器的URL+打印的文件名,转化为Base64编码
  1478. /// </summary>
  1479. protected string strPrintData;
  1480. /// <summary>
  1481. /// 标识是否安装了控件
  1482. /// </summary>
  1483. protected bool bIsInstallPrintControl = true;
  1484. /// <summary>
  1485. /// 打印控件的Cookie值
  1486. /// </summary>
  1487. protected string strPrintControlCookie = "";
  1488. /// <summary>
  1489. /// 获取Url中去掉文件名的路径
  1490. /// </summary>
  1491. /// <returns></returns>
  1492. private string GetUrlPath()
  1493. {
  1494. string strUrl = Request.Url.ToString();
  1495. int iEnd = strUrl.LastIndexOf("/");
  1496. strUrl = strUrl.Substring(0, iEnd + 1);
  1497. return strUrl;
  1498. }
  1499. /// <summary>
  1500. /// 设置控件调用的Cookie值,判断是否安装了打印控件
  1501. /// </summary>
  1502. /// <param name="pJson"></param>
  1503. private void SetCookieAndURL(PrintJson pJson)
  1504. {
  1505. bIsInstallPrintControl = false;
  1506. strPrintControlCookie = "";
  1507. HttpCookie pCookieInstall = Request.Cookies["InstallPrintControl"];
  1508. if (pCookieInstall != null)
  1509. { //Cookie存在
  1510. strPrintControlCookie = pCookieInstall.Value.ToString();
  1511. //以Cookie值查找在数据表中是否存在
  1512. string strSql = @"Select * From sys_SRM_CheckInstall Where Cookie = @Cookie";
  1513. SqlParameter[] pmcCookie = { new SqlParameter("Cookie", strPrintControlCookie) };
  1514. using (SqlDataReader drCookie = DbHelper.ExecuteReader(DbHelper.ConnectionString, CommandType.Text, strSql, pmcCookie))
  1515. {
  1516. if (drCookie.Read())
  1517. { //标识为已经安装
  1518. bIsInstallPrintControl = true;
  1519. }
  1520. drCookie.Close();
  1521. }
  1522. //更新Cookie的保存时间
  1523. pCookieInstall.Expires = DateTime.Now.AddYears(10);
  1524. Response.SetCookie(pCookieInstall);
  1525. }
  1526. else
  1527. {//Cookie不存在,则新建Cookie
  1528. strPrintControlCookie = System.Guid.NewGuid().ToString();
  1529. pCookieInstall = new HttpCookie("InstallPrintControl", strPrintControlCookie);
  1530. pCookieInstall.Expires = DateTime.Now.AddYears(10);
  1531. Response.Cookies.Add(pCookieInstall);
  1532. }
  1533. string strUrl = Server.MapPath("/PrintTemp/") + "IsCheckInstall";
  1534. pJson.SetCookieAndURL(strPrintControlCookie, strUrl);
  1535. }
  1536. [HttpPost]
  1537. [HandlerAjaxOnly]
  1538. public ActionResult PrintStack(string keyValue)
  1539. {
  1540. keyValue = keyValue.Substring(1, keyValue.Length - 2);
  1541. string strPrintFileName = Server.MapPath("/ReportFile/") + "Stack.fr3";
  1542. PrintJson pJson = new PrintJson(Server.MapPath("./PrintTemp"), strPrintFileName);
  1543. pJson.CheckRegister("苏州智合诚信息科技有限公司", "56DD3B4C172D0D140841CAC98A58A819F4E28EDA5D6E45711DDD64F6A439F68B6A7870CD7DAFD69A919CB870207FE4BB206F92BE3D53C221B019E0797E739EBA4"); //注册信息
  1544. pJson.MasterOptions(1, "STNO", false); //主从关系
  1545. SetCookieAndURL(pJson);// 设置控件调用的Cookie值,判断是否安装了打印控件
  1546. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  1547. string strSql = @"select a.LocationCode,
  1548. a.ID,
  1549. a.LocationName,
  1550. b.WarehouseCode,
  1551. b.WarehouseName,
  1552. a.Musername as 'MUSER',
  1553. a.MTIME
  1554. from ICSLocation a WITH (NOLOCK)
  1555. inner join ICSWarehouse b WITH (NOLOCK) on a.WHID=b.ID
  1556. where 1=1
  1557. and a.ID IN (" + keyValue.TrimEnd(',') + ")";
  1558. DataTable dtInInfo = DbHelper.ExecuteTable(DbHelper.ConnectionString, CommandType.Text, strSql, true, null);
  1559. // strSql = @"SELECT Row_Number() OVER (partition BY a.STNO ORDER BY a.CREATETIME DESC) AS rowno,c.STNO,
  1560. // c.PLANQTY,c.LotnoQTY,c.CartonNOQTY,c.ITEMCODE,b.INVNAME,b.INVSTD,b.INVPARSETYPE,d.StorageName,
  1561. // CONVERT(VARCHAR,CAST(ISNULL(c.Qty,0) AS money),1) AS Qty,
  1562. // CONVERT(VARCHAR,CAST(ISNULL(c.Meters,0) AS money),1) AS Meters,
  1563. // c.STNO AS QRSTNO,c.TransNO,c.TransLine,c.MEMO,c.VenderLotNO,CONVERT(varchar(10), c.PRODUCTDATE, 23) as PRODUCTDATE,a.remark
  1564. // FROM
  1565. // (SELECT aa.STNO,aa.ITEMCODE,aa.WorkPoint,SUM(aa.PLANQTY) PLANQTY,SUM(cc.LOTQTY) Qty,
  1566. // SUM(ISNULL(cc.Meters,0)) Meters,cc.TransNO,cc.TransLine,dd.MEMO,cc.VenderLotNO,cc.PRODUCTDATE,
  1567. // COUNT(aa.LOTNO) LotnoQTY,COUNT(bb.CartonNO) CartonNOQTY
  1568. // FROM ICSASNDETAIL aa
  1569. // LEFT JOIN ICSITEMLot2Carton bb ON aa.LOTNO = bb.LotNO AND aa.WorkPoint = bb.WorkPoint
  1570. // LEFT JOIN ICSITEMLot cc ON aa.LOTNO = cc.LotNO AND aa.WorkPoint = cc.WorkPoint
  1571. // LEFT JOIN ICSPO_PoMain dd on dd.POCode=cc.TransNO and dd.PORow=cc.TransLine
  1572. // GROUP BY aa.stno,aa.itemcode,aa.WorkPoint,cc.TransNO,cc.TransLine,dd.MEMO,cc.VenderLotNO,cc.PRODUCTDATE) c
  1573. // LEFT JOIN ICSASN a on c.stno=a.stno AND c.WorkPoint=a.WorkPoint
  1574. // LEFT JOIN dbo.ICSINVENTORY b ON c.ITEMCODE=b.INVCODE AND b.WorkPoint=c.WorkPoint
  1575. // LEFT JOIN dbo.icsstorage d ON b.INVMACHINETYPE=d.StorageCode
  1576. // WHERE c.STNO IN (" + keyValue.TrimEnd(',') + ") and c.WorkPoint='" + WorkPoint + "'";
  1577. // DataTable dtInMaterial = DbHelper.ExecuteTable(DbHelper.ConnectionString, CommandType.Text, strSql, true, null);
  1578. string strPrintTempFile = pJson.ShowReport(dtInInfo, null); //产生JSON文件内容
  1579. //把服务器的URL + 此文件名 传递给控件,由控件下载还原数据进行打印
  1580. string strServerURL = Server.MapPath("/PrintTemp/");
  1581. string strData = strServerURL + strPrintTempFile;
  1582. strPrintData = PrintFunction.EnBase64(strData);
  1583. var JsonData = new
  1584. {
  1585. strPrintData_1 = strPrintData,
  1586. bIsInstallPrintControl_1 = bIsInstallPrintControl,
  1587. strPrintControlCookie_1 = strPrintControlCookie
  1588. };
  1589. // string sql = @"UPDATE dbo.ICSASN
  1590. // SET ADDITION1=ISNULL(ADDITION1,0)+1,
  1591. // ADDITION2=CONVERT(varchar(100), GETDATE(), 21)
  1592. // WHERE STNO in (" + keyValue.TrimEnd(',') + ") and WorkPoint='" + WorkPoint + "'";
  1593. // SqlHelper.ExecuteNonQuery(sql);
  1594. return Content(JsonData.ToJson());
  1595. }
  1596. /// <summary>
  1597. /// 写日志(用于跟踪)
  1598. /// </summary>
  1599. private void WriteLog(string strMessage)
  1600. {
  1601. string strLogFile = Server.MapPath("./Cookie_Log.txt");
  1602. StreamWriter swLogFile = null;
  1603. try
  1604. {
  1605. if (!System.IO.File.Exists(strLogFile))
  1606. {
  1607. swLogFile = System.IO.File.CreateText(strLogFile);
  1608. }
  1609. else
  1610. {
  1611. swLogFile = System.IO.File.AppendText(strLogFile);
  1612. }
  1613. swLogFile.WriteLine(strMessage);
  1614. }
  1615. catch
  1616. {
  1617. }
  1618. finally
  1619. {
  1620. if (swLogFile != null)
  1621. swLogFile.Close();
  1622. }
  1623. }
  1624. /// <summary>
  1625. ///判断数据表中是否存在,若不存在则新建一条记录,若存在则更新最后访问的时间
  1626. /// </summary>
  1627. /// <param name="strCookie"></param>
  1628. private void UpdateCheckInstall(string strCookie)
  1629. {
  1630. bool bIsExist = false;
  1631. //判断记录是否存在
  1632. GetLastAccessTime(strCookie, ref bIsExist);
  1633. string strSql = "";
  1634. SqlParameter[] pmcCookie = { new SqlParameter("Cookie", strCookie) };
  1635. if (bIsExist)
  1636. { //存在则更新最后访问的时间
  1637. strSql = @"Update sys_SRM_CheckInstall
  1638. Set LastAccessTime = getDate()
  1639. Where Cookie = @Cookie";
  1640. }
  1641. else
  1642. { //不存在则新建一条记录
  1643. strSql = @"Insert into sys_SRM_CheckInstall(Cookie, LastAccessTime)
  1644. Values( @Cookie, getDate() )";
  1645. }
  1646. DbHelper.ExecuteNonQuery(DbHelper.ConnectionString, CommandType.Text, strSql, pmcCookie);
  1647. }
  1648. public DateTime ToDateTime(object SrcValue)
  1649. {
  1650. if (Convert.IsDBNull(SrcValue) == true)
  1651. return DateTime.MinValue;
  1652. else
  1653. {
  1654. try
  1655. {
  1656. return Convert.ToDateTime(SrcValue);
  1657. }
  1658. catch
  1659. {
  1660. return DateTime.MinValue;
  1661. }
  1662. }
  1663. }
  1664. /// <summary>
  1665. /// 获取此Cookie的最后访问时间
  1666. /// </summary>
  1667. /// <param name="strCookie"></param>
  1668. /// <returns></returns>
  1669. private DateTime GetLastAccessTime(string strCookie, ref bool bIsExist)
  1670. {
  1671. DateTime dtLastAccessTime = DateTime.MinValue;
  1672. bIsExist = false;
  1673. string strSql = @"Select * From sys_SRM_CheckInstall Where Cookie = @Cookie";
  1674. SqlParameter[] pmcCookie = { new SqlParameter("Cookie", strCookie) };
  1675. using (SqlDataReader drCookie = DbHelper.ExecuteReader(DbHelper.ConnectionString, CommandType.Text, strSql, pmcCookie))
  1676. {
  1677. if (drCookie.Read())
  1678. {
  1679. dtLastAccessTime = ToDateTime(drCookie["LastAccessTime"]);
  1680. bIsExist = true;
  1681. }
  1682. drCookie.Close();
  1683. }
  1684. return dtLastAccessTime;
  1685. }
  1686. [HttpGet]
  1687. [HandlerAjaxOnly]
  1688. public ActionResult IsCheckInstall(string checkInstall)
  1689. {
  1690. string strValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss 访问,");
  1691. if (Request.QueryString["cookie"] != null)
  1692. { //有控件上传的Cookie值
  1693. string strCookie = Request.QueryString["cookie"].ToString();
  1694. //判断数据表中是否存在,若不存在则新建一条记录,若存在则更新最后访问的时间
  1695. UpdateCheckInstall(strCookie);
  1696. strValue = strValue + "上传的cookie:" + strCookie;
  1697. }
  1698. else if (checkInstall != null)
  1699. {//Ajax检查控件是否安装了,防止那种客户把打印控件卸装了,打印时无法检测到的情况
  1700. string strCookie = checkInstall;
  1701. //读取最后访问的时间
  1702. string strResult = "PrintControlInstall";
  1703. bool bIsExist = false;
  1704. DateTime dtLastAccessTime = GetLastAccessTime(strCookie, ref bIsExist);
  1705. if (!bIsExist || dtLastAccessTime.AddSeconds(30) < DateTime.Now)
  1706. {
  1707. strResult = "NOT";
  1708. }
  1709. Response.Clear();
  1710. Response.Write(strResult);
  1711. strValue = strValue + "检测安装的值:" + strCookie;
  1712. }
  1713. WriteLog(strValue);
  1714. return null;
  1715. }
  1716. [HttpGet]
  1717. [HandlerAjaxOnly]
  1718. public ActionResult IsCheckInstall()
  1719. {
  1720. string strValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss 访问,");
  1721. if (Request.QueryString["cookie"] != null)
  1722. { //有控件上传的Cookie值
  1723. string strCookie = Request.QueryString["cookie"].ToString();
  1724. //判断数据表中是否存在,若不存在则新建一条记录,若存在则更新最后访问的时间
  1725. UpdateCheckInstall(strCookie);
  1726. strValue = strValue + "上传的cookie:" + strCookie;
  1727. }
  1728. else if (Request.QueryString["checkInstall"] != null)
  1729. {//Ajax检查控件是否安装了,防止那种客户把打印控件卸装了,打印时无法检测到的情况
  1730. string strCookie = Request.QueryString["checkInstall"];
  1731. //读取最后访问的时间
  1732. string strResult = "PrintControlInstall";
  1733. bool bIsExist = false;
  1734. DateTime dtLastAccessTime = GetLastAccessTime(strCookie, ref bIsExist);
  1735. if (!bIsExist || dtLastAccessTime.AddSeconds(30) < DateTime.Now)
  1736. {
  1737. strResult = "NOT";
  1738. }
  1739. Response.Clear();
  1740. Response.Write(strResult);
  1741. strValue = strValue + "检测安装的值:" + strCookie;
  1742. }
  1743. WriteLog(strValue);
  1744. return null;
  1745. }
  1746. #endregion
  1747. [HttpGet]
  1748. [HandlerAjaxOnly]
  1749. public ActionResult GetTXT(string ID)
  1750. {
  1751. DataTable ListData = App.GetTXT(ID);
  1752. var JsonData = new
  1753. {
  1754. rows = ListData,
  1755. };
  1756. return Content(JsonData.ToJson());
  1757. }
  1758. //修改标签数据源
  1759. [HttpPost]
  1760. [HandlerAjaxOnly]
  1761. public ActionResult updateLableDataSource(string Sys_LableDataSource)
  1762. {
  1763. string msg = App.updateLableDataSource(Sys_LableDataSource);
  1764. if (!string.IsNullOrEmpty(msg))
  1765. {
  1766. return Error(msg);
  1767. }
  1768. else
  1769. {
  1770. return Success("添加成功!");
  1771. }
  1772. }
  1773. [HttpPost]
  1774. [HandlerAjaxOnly]
  1775. [ValidateAntiForgeryToken]
  1776. public ActionResult DeleteLableDataSource(string keyValue)
  1777. {
  1778. string msg = App.DeleteLableDataSource(keyValue);
  1779. if (string.IsNullOrEmpty(msg))
  1780. {
  1781. return Success("删除成功!");
  1782. }
  1783. else
  1784. {
  1785. return Error(msg);
  1786. }
  1787. }
  1788. [HttpGet]
  1789. [HandlerAjaxOnly]
  1790. public ActionResult GetLableType()
  1791. {
  1792. DataTable dt = App.GetLableType();
  1793. return Content(dt.ToJson());
  1794. }
  1795. [HttpGet]
  1796. [HandlerAjaxOnly]
  1797. public ActionResult GetSys_LablesID()
  1798. {
  1799. DataTable dt = App.GetSys_LablesID();
  1800. return Content(dt.ToJson());
  1801. }
  1802. //新增标签数据源
  1803. [HttpPost]
  1804. [HandlerAjaxOnly]
  1805. public ActionResult CreateLables(string txtLableName, string sel_LableType, string sel_LableSourceID)
  1806. {
  1807. string msg = App.CreateLables(txtLableName, sel_LableType, sel_LableSourceID);
  1808. if (!string.IsNullOrEmpty(msg))
  1809. {
  1810. return Error(msg);
  1811. }
  1812. else
  1813. {
  1814. return Success("添加成功!");
  1815. }
  1816. }
  1817. [HttpGet]
  1818. [HandlerAjaxOnly]
  1819. public ActionResult GetLabelTXT(string ID)
  1820. {
  1821. DataTable ListData = App.GetLabelTXT(ID);
  1822. var JsonData = new
  1823. {
  1824. rows = ListData,
  1825. };
  1826. return Content(JsonData.ToJson());
  1827. }
  1828. [HttpPost]
  1829. [HandlerAjaxOnly]
  1830. public ActionResult updateLables(string ID, string txtLableName, string sel_LableType, string sel_LableSourceID)
  1831. {
  1832. string msg = App.updateLables(ID, txtLableName, sel_LableType, sel_LableSourceID);
  1833. if (!string.IsNullOrEmpty(msg))
  1834. {
  1835. return Error(msg);
  1836. }
  1837. else
  1838. {
  1839. return Success("修改成功!");
  1840. }
  1841. }
  1842. [HttpPost]
  1843. [HandlerAjaxOnly]
  1844. [ValidateAntiForgeryToken]
  1845. public ActionResult DeleteICSLabelTemplate(string keyValue)
  1846. {
  1847. string msg = App.DeleteICSLabelTemplate(keyValue);
  1848. if (string.IsNullOrEmpty(msg))
  1849. {
  1850. return Success("删除成功!");
  1851. }
  1852. else
  1853. {
  1854. return Error(msg);
  1855. }
  1856. }
  1857. //获取父容器
  1858. [HttpGet]
  1859. [HandlerAjaxOnly]
  1860. public ActionResult GetContainerID()
  1861. {
  1862. DataTable dt = App.GetContainerID();
  1863. return Content(dt.ToJson());
  1864. }
  1865. //获取父容器
  1866. [HttpGet]
  1867. [HandlerAjaxOnly]
  1868. public ActionResult GetContainerType()
  1869. {
  1870. DataTable dt = App.GetContainerType();
  1871. return Content(dt.ToJson());
  1872. }
  1873. [HttpPost]
  1874. public ActionResult UpLoadLabelFile()
  1875. {
  1876. //获取上传的文件集合
  1877. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  1878. //获取送货单号
  1879. string ID = Request.Form["ID"].ToString();
  1880. string LableName = Request.Form["LableName"].ToString();
  1881. string fileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName)
  1882. + "_" + LableName + Path.GetExtension(httpFile[0].FileName);
  1883. string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\LablesFile\\" + fileName);
  1884. int iLen = httpFile[0].ContentLength;
  1885. byte[] bData = new byte[iLen];
  1886. httpFile[0].InputStream.Read(bData, 0, iLen);
  1887. FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
  1888. fs.Write(bData, 0, bData.Length);
  1889. fs.Flush();
  1890. fs.Close();
  1891. fs.Dispose();
  1892. int count = App.UpLoadLabelFile(ID, fileName);
  1893. if (count > 0)
  1894. {
  1895. return Success("上传成功!");
  1896. }
  1897. else
  1898. {
  1899. return Error("上传失败");
  1900. }
  1901. }
  1902. [HttpPost]
  1903. public ActionResult UpLoadFileTxT()
  1904. {
  1905. //获取上传的文件集合
  1906. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  1907. //获取送货单号
  1908. string LotNo = Request.Form["LotNo"].ToString();
  1909. string fileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName)
  1910. + Path.GetExtension(httpFile[0].FileName);
  1911. string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + fileName);
  1912. int iLen = httpFile[0].ContentLength;
  1913. byte[] bData = new byte[iLen];
  1914. httpFile[0].InputStream.Read(bData, 0, iLen);
  1915. FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
  1916. fs.Write(bData, 0, bData.Length);
  1917. fs.Flush();
  1918. fs.Close();
  1919. fs.Dispose();
  1920. int count = App.UpLoadFiles(LotNo, fileName);
  1921. if (count > 0)
  1922. {
  1923. return Success("上传成功!");
  1924. }
  1925. else
  1926. {
  1927. return Error("上传失败");
  1928. }
  1929. }
  1930. //包装容器
  1931. public ActionResult GetSendContainer(Pagination pagination, string queryJson)
  1932. {
  1933. DataTable ListData = App.GetSendContainer(ref pagination, queryJson);
  1934. var JsonData = new
  1935. {
  1936. total = pagination.total,
  1937. page = pagination.page,
  1938. records = pagination.records,
  1939. rows = ListData,
  1940. };
  1941. return Content(JsonData.ToJson());
  1942. }
  1943. [HttpGet]
  1944. [HandlerAjaxOnly]
  1945. public ActionResult GetContainerInfo(string Code)
  1946. {
  1947. DataTable ListData = App.GetContainerInfo(Code);
  1948. var JsonData = new
  1949. {
  1950. rows = ListData,
  1951. };
  1952. return Content(JsonData.ToJson());
  1953. }
  1954. [HttpGet]
  1955. [HandlerAjaxOnly]
  1956. public ActionResult GetBindContainerID(string SireCode)
  1957. {
  1958. DataTable ListData = App.GetBindContainerID(SireCode);
  1959. var JsonData = new
  1960. {
  1961. rows = ListData,
  1962. };
  1963. return Content(JsonData.ToJson());
  1964. }
  1965. //包装容器关联条码
  1966. public ActionResult GetSendContainerLot(Pagination pagination, string queryJson)
  1967. {
  1968. DataTable ListData = App.GetSendContainerLot(ref pagination, queryJson);
  1969. var JsonData = new
  1970. {
  1971. total = pagination.total,
  1972. page = pagination.page,
  1973. records = pagination.records,
  1974. rows = ListData,
  1975. };
  1976. return Content(JsonData.ToJson());
  1977. }
  1978. [HttpGet]
  1979. [HandlerAjaxOnly]
  1980. public ActionResult GetContainerLotInfo(string LotNo)
  1981. {
  1982. DataTable ListData = App.GetContainerLotInfo(LotNo);
  1983. var JsonData = new
  1984. {
  1985. rows = ListData,
  1986. };
  1987. return Content(JsonData.ToJson());
  1988. }
  1989. /// <summary>
  1990. /// 删除站点
  1991. /// </summary>
  1992. /// <returns></returns>
  1993. [HttpPost]
  1994. [HandlerAjaxOnly]
  1995. [ValidateAntiForgeryToken]
  1996. public ActionResult DeleteWorkPoint(string keyValue)
  1997. {
  1998. string msg = App.DeleteWorkPoint(keyValue);
  1999. if (string.IsNullOrEmpty(msg))
  2000. {
  2001. return Success("删除成功!");
  2002. }
  2003. else
  2004. {
  2005. return Error(msg);
  2006. }
  2007. }
  2008. [HttpGet]
  2009. [HandlerAjaxOnly]
  2010. public ActionResult GetICSInventoryLotInfo(string ID)
  2011. {
  2012. DataTable ListData = App.GetICSInventoryLotInfo(ID);
  2013. var JsonData = new
  2014. {
  2015. rows = ListData,
  2016. };
  2017. return Content(JsonData.ToJson());
  2018. }
  2019. [HttpGet]
  2020. [HandlerAjaxOnly]
  2021. public ActionResult GetICSBatchInfo(string BatchCode, string INVCode)
  2022. {
  2023. DataTable ListData = App.GetICSBatchInfo(BatchCode, INVCode);
  2024. var JsonData = new
  2025. {
  2026. rows = ListData,
  2027. };
  2028. return Content(JsonData.ToJson());
  2029. }
  2030. [HttpPost]
  2031. [HandlerAjaxOnly]
  2032. [ValidateAntiForgeryToken]
  2033. public ActionResult UpdateExpirationDate(string ID, string ExpirationDate, string Inv, string LotNo, string InvCode, string Quantity)
  2034. {
  2035. int i = App.UpdateExpirationDate(ID, ExpirationDate, Inv, LotNo, InvCode, Quantity);
  2036. if (i > 0)
  2037. {
  2038. return Success("维护成功!");
  2039. }
  2040. else
  2041. {
  2042. return Error("维护失败!");
  2043. }
  2044. }
  2045. [HttpPost]
  2046. [HandlerAjaxOnly]
  2047. [ValidateAntiForgeryToken]
  2048. public ActionResult UpdateBatchExpirationDate(string ExpirationDate, string BatchCode, string InvCode)
  2049. {
  2050. try
  2051. {
  2052. int i = App.UpdateBatchExpirationDate(ExpirationDate, BatchCode, InvCode);
  2053. if (i > 0)
  2054. {
  2055. return Success("维护成功!");
  2056. }
  2057. else
  2058. {
  2059. return Error("维护失败!");
  2060. }
  2061. }
  2062. catch (Exception ex)
  2063. {
  2064. return Error(ex.Message);
  2065. }
  2066. }
  2067. //修改多语言
  2068. [HttpPost]
  2069. [HandlerAjaxOnly]
  2070. public ActionResult UpdateSys_Language(string keyValue)
  2071. {
  2072. string msg = App.UpdateSys_Language(keyValue);
  2073. if (!string.IsNullOrEmpty(msg))
  2074. {
  2075. return Error(msg);
  2076. }
  2077. else
  2078. {
  2079. return Success("修改成功!");
  2080. }
  2081. }
  2082. //新增多语言
  2083. [HttpPost]
  2084. [HandlerAjaxOnly]
  2085. public ActionResult InsertSys_Language(string keyValue)
  2086. {
  2087. string msg = App.InsertSys_Language(keyValue);
  2088. if (!string.IsNullOrEmpty(msg))
  2089. {
  2090. return Error(msg);
  2091. }
  2092. else
  2093. {
  2094. return Success("添加成功!");
  2095. }
  2096. }
  2097. [HttpGet]
  2098. [HandlerAjaxOnly]
  2099. public ActionResult GetSys_Language(string ID)
  2100. {
  2101. DataTable ListData = App.GetSys_Language(ID);
  2102. var JsonData = new
  2103. {
  2104. rows = ListData,
  2105. };
  2106. return Content(JsonData.ToJson());
  2107. }
  2108. [HttpPost]
  2109. [HandlerAjaxOnly]
  2110. [ValidateAntiForgeryToken]
  2111. public ActionResult DeleteSys_Language(string keyValue)
  2112. {
  2113. string msg = App.DeleteSys_Language(keyValue);
  2114. if (string.IsNullOrEmpty(msg))
  2115. {
  2116. return Success("删除成功!");
  2117. }
  2118. else
  2119. {
  2120. return Error(msg);
  2121. }
  2122. }
  2123. //料品检验明细
  2124. public ActionResult GetICSInventoryInspectionGroup(Pagination pagination, string queryJson)
  2125. {
  2126. DataTable ListData = App.GetICSInventoryInspectionGroup(ref pagination, queryJson);
  2127. var JsonData = new
  2128. {
  2129. total = pagination.total,
  2130. page = pagination.page,
  2131. records = pagination.records,
  2132. rows = ListData,
  2133. };
  2134. return Content(JsonData.ToJson());
  2135. }
  2136. //料品检验明细子表
  2137. [HttpGet]
  2138. [HandlerAjaxOnly]
  2139. public ActionResult ICSInventoryInspectionList(string ID, Pagination pagination)
  2140. {
  2141. DataTable ListData = App.ICSInventoryInspectionList(ID, ref pagination);
  2142. var JsonData = new
  2143. {
  2144. total = pagination.total,
  2145. page = pagination.page,
  2146. records = pagination.records,
  2147. rows = ListData,
  2148. };
  2149. return Content(JsonData.ToJson());
  2150. }
  2151. //删除料品检验明细子表
  2152. [HttpPost]
  2153. [HandlerAjaxOnly]
  2154. [ValidateAntiForgeryToken]
  2155. public ActionResult DeleteICSInventoryInspectionGroup(string keyValue)
  2156. {
  2157. string msg = App.DeleteICSInventoryInspectionGroup(keyValue);
  2158. if (string.IsNullOrEmpty(msg))
  2159. {
  2160. return Success("删除成功!");
  2161. }
  2162. else
  2163. {
  2164. return Error(msg);
  2165. }
  2166. }
  2167. //查询物料
  2168. [HttpGet]
  2169. public ActionResult GetINv(string invcode, Pagination pagination)
  2170. {
  2171. DataTable ListData = App.Getinv(invcode, ref pagination);
  2172. var JsonData = new
  2173. {
  2174. total = pagination.total,
  2175. page = pagination.page,
  2176. records = pagination.records,
  2177. rows = ListData,
  2178. };
  2179. return Content(JsonData.ToJson());
  2180. }
  2181. [HttpGet]
  2182. [HandlerAjaxOnly]
  2183. public ActionResult GetGroupCode()
  2184. {
  2185. DataTable dt = App.GetGroupCode();
  2186. return Content(dt.ToJson());
  2187. }
  2188. [HttpGet]
  2189. public ActionResult DeleteItem(string ID)
  2190. {
  2191. try
  2192. {
  2193. App.DeleteItem(ID);
  2194. return Success("删除成功!");
  2195. }
  2196. catch (Exception ex)
  2197. {
  2198. return Error(ex.Message);
  2199. }
  2200. }
  2201. [HttpGet]
  2202. [HandlerAjaxOnly]
  2203. public ActionResult GetICSInventoryInspectionList(string BRGCode, Pagination pagination)
  2204. {
  2205. DataTable ListData = App.GetICSInventoryInspectionList(BRGCode, ref pagination);
  2206. var JsonData = new
  2207. {
  2208. total = pagination.total,
  2209. page = pagination.page,
  2210. records = pagination.records,
  2211. rows = ListData,
  2212. };
  2213. return Content(JsonData.ToJson());
  2214. }
  2215. [HttpGet]
  2216. [HandlerAjaxOnly]
  2217. public ActionResult GetInspectionListInfo(string ID)
  2218. {
  2219. DataTable ListData = App.GetInspectionListInfo(ID);
  2220. var JsonData = new
  2221. {
  2222. rows = ListData,
  2223. };
  2224. return Content(JsonData.ToJson());
  2225. }
  2226. [HttpGet]
  2227. public ActionResult GetICSInventoryInspectionList2(string BID)
  2228. {
  2229. var data = App.GetICSInventoryInspectionList2(BID);
  2230. return Content(data.ToJson());
  2231. }
  2232. //料品不良组导入
  2233. [HttpPost]
  2234. /// <summary>
  2235. /// 文件上传到本地
  2236. /// </summary>
  2237. public string UploadFileInvBadGroup()
  2238. {
  2239. try
  2240. {
  2241. HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files;
  2242. if (hpFiles != null && hpFiles.Count > 0)
  2243. {
  2244. string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
  2245. if (IsXls != ".xls" && IsXls != ".xlsx")
  2246. {
  2247. return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
  2248. }
  2249. string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + Guid.NewGuid() + IsXls; //获取Execle文件名 DateTime日期函数
  2250. string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
  2251. int iLen = hpFiles[0].ContentLength;
  2252. if (Directory.Exists(savePath)) return "文件已存在";
  2253. byte[] bData = new byte[iLen];
  2254. hpFiles[0].InputStream.Read(bData, 0, iLen);
  2255. FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate);
  2256. newFile.Write(bData, 0, bData.Length);
  2257. newFile.Flush();
  2258. int _FileSizeTemp = hpFiles[0].ContentLength;
  2259. newFile.Close();
  2260. newFile.Dispose();
  2261. //bool del = false;
  2262. string mess = "";
  2263. mess = App.UploadFileInvBadGroup(savePath);
  2264. if (System.IO.File.Exists(savePath))//删除文件
  2265. {
  2266. System.IO.File.Delete(savePath);
  2267. }
  2268. return mess;
  2269. }
  2270. else
  2271. {
  2272. return "获取文件失败";
  2273. }
  2274. }
  2275. catch (Exception ex)
  2276. {
  2277. return ex.ToString();
  2278. }
  2279. }
  2280. //根据ID获取其他站点
  2281. public ActionResult GetWorkPointNotInID(string WorkPointCode)
  2282. {
  2283. DataTable dt = App.GetWorkPointNotInID(WorkPointCode);
  2284. return Content(dt.ToJson());
  2285. }
  2286. //克隆站点
  2287. [HttpPost]
  2288. [HandlerAjaxOnly]
  2289. public ActionResult CloneWorkPointByCode(string WorkPoint, string WorkPointCode)
  2290. {
  2291. string msg = App.CloneWorkPointByCode(WorkPoint, WorkPointCode);
  2292. if (!string.IsNullOrEmpty(msg))
  2293. {
  2294. return Error(msg);
  2295. }
  2296. else
  2297. {
  2298. return Success("修改成功!");
  2299. }
  2300. }
  2301. [HttpPost]
  2302. [HandlerAjaxOnly]
  2303. public ActionResult DeleteTableByCode(string TableCode)
  2304. {
  2305. string msg = App.DeleteTableByCode(TableCode);
  2306. if (!string.IsNullOrEmpty(msg))
  2307. {
  2308. return Error(msg);
  2309. }
  2310. else
  2311. {
  2312. return Success("添加成功!");
  2313. }
  2314. }
  2315. /// <summary>
  2316. /// 获取抽样规则子表
  2317. /// </summary>
  2318. /// <param name="GroupCode"></param>
  2319. /// <param name="pagination"></param>
  2320. /// <returns></returns>
  2321. [HttpGet]
  2322. [HandlerAjaxOnly]
  2323. public ActionResult GetICSInspectionRulesList(string GroupCode, Pagination pagination)
  2324. {
  2325. DataTable ListData = App.GetICSInspectionRulesList(GroupCode, ref pagination);
  2326. var JsonData = new
  2327. {
  2328. total = pagination.total,
  2329. page = pagination.page,
  2330. records = pagination.records,
  2331. rows = ListData,
  2332. };
  2333. return Content(JsonData.ToJson());
  2334. }
  2335. /// <summary>
  2336. /// 动态子表修改加载页面
  2337. /// </summary>
  2338. /// <param name="GroupCode"></param>
  2339. /// <returns></returns>
  2340. [HttpGet]
  2341. public ActionResult GetICSInspectionRulesList2(string RulesCode)
  2342. {
  2343. var data = App.GetICSInspectionRulesList2(RulesCode);
  2344. return Content(data.ToJson());
  2345. }
  2346. [HttpGet]
  2347. public ActionResult GetICSInspectionRulesGroup(Pagination pagination, string queryJson)
  2348. {
  2349. DataTable ListData = App.GetICSInspectionRulesGroup(ref pagination, queryJson);
  2350. var JsonData = new
  2351. {
  2352. total = pagination.total,
  2353. page = pagination.page,
  2354. records = pagination.records,
  2355. rows = ListData,
  2356. };
  2357. return Content(JsonData.ToJson());
  2358. }
  2359. /// <summary>
  2360. /// 删除抽检规则
  2361. /// </summary>
  2362. /// <returns></returns>
  2363. [HttpPost]
  2364. [HandlerAjaxOnly]
  2365. [ValidateAntiForgeryToken]
  2366. public ActionResult DeleteICSInspectionRulesGroup(string keyValue)
  2367. {
  2368. string msg = App.DeleteICSInspectionRulesGroup(keyValue);
  2369. if (string.IsNullOrEmpty(msg))
  2370. {
  2371. return Success("删除成功!");
  2372. }
  2373. else
  2374. {
  2375. return Error(msg);
  2376. }
  2377. }
  2378. /// <summary>
  2379. /// 获取抽样规则子表
  2380. /// </summary>
  2381. /// <param name="GroupCode"></param>
  2382. /// <param name="pagination"></param>
  2383. /// <returns></returns>
  2384. [HttpGet]
  2385. [HandlerAjaxOnly]
  2386. public ActionResult GetICSInspectionRulesListBYCode(string RulesCode, Pagination pagination)
  2387. {
  2388. DataTable ListData = App.GetICSInspectionRulesListBYCode(RulesCode, ref pagination);
  2389. var JsonData = new
  2390. {
  2391. total = pagination.total,
  2392. page = pagination.page,
  2393. records = pagination.records,
  2394. rows = ListData,
  2395. };
  2396. return Content(JsonData.ToJson());
  2397. }
  2398. //料品不良组导入
  2399. [HttpPost]
  2400. /// <summary>
  2401. /// 文件上传到本地
  2402. /// </summary>
  2403. public string UploadFileInspectionRulesList()
  2404. {
  2405. try
  2406. {
  2407. HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files;
  2408. if (hpFiles != null && hpFiles.Count > 0)
  2409. {
  2410. string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
  2411. if (IsXls != ".xls" && IsXls != ".xlsx")
  2412. {
  2413. return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
  2414. }
  2415. string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + Guid.NewGuid() + IsXls; //获取Execle文件名 DateTime日期函数
  2416. string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
  2417. int iLen = hpFiles[0].ContentLength;
  2418. if (Directory.Exists(savePath)) return "文件已存在";
  2419. byte[] bData = new byte[iLen];
  2420. hpFiles[0].InputStream.Read(bData, 0, iLen);
  2421. FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate);
  2422. newFile.Write(bData, 0, bData.Length);
  2423. newFile.Flush();
  2424. int _FileSizeTemp = hpFiles[0].ContentLength;
  2425. newFile.Close();
  2426. newFile.Dispose();
  2427. //bool del = false;
  2428. string mess = "";
  2429. mess = App.UploadFileInspectionRulesList(savePath);
  2430. if (System.IO.File.Exists(savePath))//删除文件
  2431. {
  2432. System.IO.File.Delete(savePath);
  2433. }
  2434. return mess;
  2435. }
  2436. else
  2437. {
  2438. return "获取文件失败";
  2439. }
  2440. }
  2441. catch (Exception ex)
  2442. {
  2443. return ex.ToString();
  2444. }
  2445. }
  2446. //物料抽检规则绑定明细
  2447. public ActionResult GetICSInventoryInspectionRulesGroup(Pagination pagination, string queryJson)
  2448. {
  2449. DataTable ListData = App.GetICSInventoryInspectionRulesGroup(ref pagination, queryJson);
  2450. var JsonData = new
  2451. {
  2452. total = pagination.total,
  2453. page = pagination.page,
  2454. records = pagination.records,
  2455. rows = ListData,
  2456. };
  2457. return Content(JsonData.ToJson());
  2458. }
  2459. ///物料抽检规则绑定明细子表
  2460. [HttpGet]
  2461. [HandlerAjaxOnly]
  2462. public ActionResult ICSInventoryInspectionRulesList(string ID, Pagination pagination)
  2463. {
  2464. DataTable ListData = App.ICSInventoryInspectionRulesList(ID, ref pagination);
  2465. var JsonData = new
  2466. {
  2467. total = pagination.total,
  2468. page = pagination.page,
  2469. records = pagination.records,
  2470. rows = ListData,
  2471. };
  2472. return Content(JsonData.ToJson());
  2473. }
  2474. //删除物料抽检规则绑定明细
  2475. [HttpPost]
  2476. [HandlerAjaxOnly]
  2477. [ValidateAntiForgeryToken]
  2478. public ActionResult DeleteICSInventoryInspectionRulesGroup(string keyValue)
  2479. {
  2480. string msg = App.DeleteICSInventoryInspectionRulesGroup(keyValue);
  2481. if (string.IsNullOrEmpty(msg))
  2482. {
  2483. return Success("删除成功!");
  2484. }
  2485. else
  2486. {
  2487. return Error(msg);
  2488. }
  2489. }
  2490. [HttpGet]
  2491. [HandlerAjaxOnly]
  2492. public ActionResult GetRulesName()
  2493. {
  2494. DataTable dt = App.GetRulesName();
  2495. return Content(dt.ToJson());
  2496. }
  2497. [HttpGet]
  2498. [HandlerAjaxOnly]
  2499. public ActionResult GetInspectionListInfoByRules(string ID)
  2500. {
  2501. DataTable ListData = App.GetInspectionListInfoByRules(ID);
  2502. var JsonData = new
  2503. {
  2504. rows = ListData,
  2505. };
  2506. return Content(JsonData.ToJson());
  2507. }
  2508. [HttpGet]
  2509. [HandlerAjaxOnly]
  2510. public ActionResult GetICSInventoryInspectionRulesList(string BID, Pagination pagination)
  2511. {
  2512. DataTable ListData = App.GetICSInventoryInspectionRulesList(BID, ref pagination);
  2513. var JsonData = new
  2514. {
  2515. total = pagination.total,
  2516. page = pagination.page,
  2517. records = pagination.records,
  2518. rows = ListData,
  2519. };
  2520. return Content(JsonData.ToJson());
  2521. }
  2522. [HttpGet]
  2523. [HandlerAjaxOnly]
  2524. public ActionResult GetICSInventoryInspectionRulesList2(string BID, Pagination pagination)
  2525. {
  2526. DataTable ListData = App.GetICSInventoryInspectionRulesList2(BID, ref pagination);
  2527. var JsonData = new
  2528. {
  2529. total = pagination.total,
  2530. page = pagination.page,
  2531. records = pagination.records,
  2532. rows = ListData,
  2533. };
  2534. return Content(JsonData.ToJson());
  2535. }
  2536. /// <summary>
  2537. /// 删除供应商
  2538. /// </summary>
  2539. /// <returns></returns>
  2540. [HttpPost]
  2541. [HandlerAjaxOnly]
  2542. [ValidateAntiForgeryToken]
  2543. public ActionResult DeleteICSVender(string keyValue)
  2544. {
  2545. string msg = App.DeleteICSVender(keyValue);
  2546. if (string.IsNullOrEmpty(msg))
  2547. {
  2548. return Success("删除成功!");
  2549. }
  2550. else
  2551. {
  2552. return Error(msg);
  2553. }
  2554. }
  2555. /// <summary>
  2556. /// 获取供应商修改文本框值
  2557. /// </summary>
  2558. [HttpPost]
  2559. [HandlerAjaxOnly]
  2560. public ActionResult GetVenderInputValue(string ID)
  2561. {
  2562. DataTable ListData = App.GetVenderInputValue(ID);
  2563. var JsonData = new
  2564. {
  2565. rows = ListData,
  2566. };
  2567. return Content(JsonData.ToJson());
  2568. }
  2569. /// <summary>
  2570. /// 新增部门
  2571. /// </summary>
  2572. /// <param name="keyValue"></param>
  2573. /// <returns></returns>
  2574. [HttpPost]
  2575. [HandlerAjaxOnly]
  2576. public ActionResult InsertICSVender(string keyValue)
  2577. {
  2578. string msg = App.InsertICSVender(keyValue);
  2579. if (!string.IsNullOrEmpty(msg))
  2580. {
  2581. return Error(msg);
  2582. }
  2583. else
  2584. {
  2585. return Success("添加成功!");
  2586. }
  2587. }
  2588. /// <summary>
  2589. /// 修改供应商
  2590. /// </summary>
  2591. /// <param name="keyValue"></param>
  2592. /// <returns></returns>
  2593. [HttpPost]
  2594. [HandlerAjaxOnly]
  2595. public ActionResult UpdateICSVender(string keyValue)
  2596. {
  2597. string msg = App.UpdateICSVender(keyValue);
  2598. if (!string.IsNullOrEmpty(msg))
  2599. {
  2600. return Error(msg);
  2601. }
  2602. else
  2603. {
  2604. return Success("修改成功!");
  2605. }
  2606. }
  2607. /// <summary>
  2608. /// 获取仓库修改文本框值
  2609. /// </summary>
  2610. [HttpPost]
  2611. [HandlerAjaxOnly]
  2612. public ActionResult GetWareHouseInputValue(string ID)
  2613. {
  2614. DataTable ListData = App.GetWareHouseInputValue(ID);
  2615. var JsonData = new
  2616. {
  2617. rows = ListData,
  2618. };
  2619. return Content(JsonData.ToJson());
  2620. }
  2621. /// <summary>
  2622. /// 新增仓库
  2623. /// </summary>
  2624. /// <param name="keyValue"></param>
  2625. /// <returns></returns>
  2626. [HttpPost]
  2627. [HandlerAjaxOnly]
  2628. public ActionResult InsertICSWareHouse(string keyValue)
  2629. {
  2630. string msg = App.InsertICSWareHouse(keyValue);
  2631. if (!string.IsNullOrEmpty(msg))
  2632. {
  2633. return Error(msg);
  2634. }
  2635. else
  2636. {
  2637. return Success("添加成功!");
  2638. }
  2639. }
  2640. /// <summary>
  2641. /// 修改仓库
  2642. /// </summary>
  2643. /// <param name="keyValue"></param>
  2644. /// <returns></returns>
  2645. [HttpPost]
  2646. [HandlerAjaxOnly]
  2647. public ActionResult UpdateICSWareHouse(string keyValue)
  2648. {
  2649. string msg = App.UpdateICSWareHouse(keyValue);
  2650. if (!string.IsNullOrEmpty(msg))
  2651. {
  2652. return Error(msg);
  2653. }
  2654. else
  2655. {
  2656. return Success("修改成功!");
  2657. }
  2658. }
  2659. /// <summary>
  2660. /// 删除仓库
  2661. /// </summary>
  2662. /// <returns></returns>
  2663. [HttpPost]
  2664. [HandlerAjaxOnly]
  2665. [ValidateAntiForgeryToken]
  2666. public ActionResult DeleteICSWareHouse(string keyValue)
  2667. {
  2668. string msg = App.DeleteICSWareHouse(keyValue);
  2669. if (string.IsNullOrEmpty(msg))
  2670. {
  2671. return Success("删除成功!");
  2672. }
  2673. else
  2674. {
  2675. return Error(msg);
  2676. }
  2677. }
  2678. [HttpGet]
  2679. public ActionResult SelectICSColumnEnableForTypeEnable()
  2680. {
  2681. var data = App.SelectICSColumnEnableForTypeEnable();
  2682. return Content(data.ToJson());
  2683. }
  2684. [HttpGet]
  2685. [HandlerAjaxOnly]
  2686. public ActionResult GetLoadShowForColumn()
  2687. {
  2688. DataTable ListData = App.GetLoadShowForColumn();
  2689. var JsonData = new
  2690. {
  2691. rows = ListData,
  2692. };
  2693. return Content(JsonData.ToJson());
  2694. }
  2695. [HttpGet]
  2696. public ActionResult SelectICSColumnEnableForEnablePulic(string TabName)
  2697. {
  2698. var data = App.SelectICSColumnEnableForEnablePulic(TabName);
  2699. return Content(data.ToJson());
  2700. }
  2701. //新增标签数据源
  2702. [HttpPost]
  2703. [HandlerAjaxOnly]
  2704. public ActionResult CreateLableDataSource(string Sys_LableDataSource)
  2705. {
  2706. string msg = App.CreateLableDataSource(Sys_LableDataSource);
  2707. if (!string.IsNullOrEmpty(msg))
  2708. {
  2709. return Error(msg);
  2710. }
  2711. else
  2712. {
  2713. return Success("添加成功!");
  2714. }
  2715. }
  2716. }
  2717. }