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

2628 lines
77 KiB

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