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.

2811 lines
82 KiB

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