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

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