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.

2833 lines
83 KiB

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