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

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