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

98 lines
3.3 KiB

3 years ago
  1. using NFine.Application.ProductManage;
  2. using NFine.Code;
  3. using NFine.Domain.Entity.ProductManage;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Web.Mvc;
  8. namespace NFine.Web.Areas.ProductManage.Controllers
  9. {
  10. public class PreSaleOrderController : ControllerBase
  11. {
  12. private PreSellApp presellApp = new PreSellApp();
  13. private PreSellDetailApp preselldetialApp = new PreSellDetailApp();
  14. private MaintainApp maintainAppApp = new MaintainApp();
  15. //private ItemsDetailApp itemsDetailApp = new ItemsDetailApp();
  16. [HttpGet]
  17. [HandlerAjaxOnly]
  18. public ActionResult GetTreeJson()
  19. {
  20. var data = presellApp.GetList();
  21. var treeList = new List<TreeViewModel>();
  22. #region 创建一个父菜单--名称为:预售订单
  23. TreeViewModel treeMain = new TreeViewModel();
  24. treeMain.id = Common.GuId();
  25. treeMain.text = "Pre Sale Order";
  26. treeMain.parentId = "0";
  27. treeMain.value = "PreSaleOrder";
  28. treeMain.isexpand = true;
  29. treeMain.complete = true;
  30. treeMain.hasChildren = true;
  31. treeList.Add(treeMain);
  32. #endregion
  33. foreach (ICSProductPreSellEntity item in data)
  34. {
  35. TreeViewModel tree = new TreeViewModel();
  36. tree.id = item.F_Id;
  37. tree.text = item.PreSellNo + (item.IsConfirm == true ? "(Confirmed)" : "");
  38. tree.value = item.PreSellNo;
  39. tree.parentId = treeMain.id;
  40. tree.isexpand = true;
  41. tree.complete = true;
  42. tree.hasChildren = false;
  43. treeList.Add(tree);
  44. }
  45. return Content(treeList.TreeViewJson());
  46. }
  47. [HttpGet]
  48. [HandlerAjaxOnly]
  49. public ActionResult GetGridJson(string itemId, string keyword)
  50. {
  51. var data = preselldetialApp.GetList2(itemId, keyword);
  52. return Content(data.ToJson());
  53. }
  54. [HttpGet]
  55. [HandlerAjaxOnly]
  56. public ActionResult GetFormJson(string keyValue)
  57. {
  58. var data = maintainAppApp.GetForm(keyValue);
  59. return Content(data.ToJson());
  60. }
  61. [HttpPost]
  62. [HandlerAjaxOnly]
  63. [HandlerAuthorize]
  64. [ValidateAntiForgeryToken]
  65. public ActionResult DeleteForm(string keyValue)
  66. {
  67. //获取选中的产品的ID数组
  68. string[] array = keyValue.Split(',');
  69. List<ICSProductEntity> pList = new List<ICSProductEntity>();
  70. foreach (string ppsdID in array)
  71. {
  72. ICSProductEntity entity = new ICSProductEntity();
  73. entity.F_Id = preselldetialApp.GetForm(ppsdID).Product_Id;
  74. entity.IsLock = false;
  75. entity.InvQty = 1;
  76. pList.Add(entity);
  77. }
  78. preselldetialApp.DeleteForm(array, pList);
  79. return Success("Delete success.");
  80. }
  81. [HttpPost]
  82. [HandlerAjaxOnly]
  83. [HandlerAuthorize]
  84. [ValidateAntiForgeryToken]
  85. public ActionResult DeleteFormOrder(string keyValue)
  86. {
  87. presellApp.DeleteForm(keyValue);
  88. return Success("Delete success.");
  89. }
  90. }
  91. }