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

2616 lines
77 KiB

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