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

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