using NFine.Application.ProductManage; using NFine.Code; using NFine.Domain.Entity.ProductManage; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web.Mvc; namespace NFine.Web.Areas.ProductManage.Controllers { public class PreSaleOrderController : ControllerBase { private PreSellApp presellApp = new PreSellApp(); private PreSellDetailApp preselldetialApp = new PreSellDetailApp(); private MaintainApp maintainAppApp = new MaintainApp(); //private ItemsDetailApp itemsDetailApp = new ItemsDetailApp(); [HttpGet] [HandlerAjaxOnly] public ActionResult GetTreeJson() { var data = presellApp.GetList(); var treeList = new List(); #region 创建一个父菜单--名称为:预售订单 TreeViewModel treeMain = new TreeViewModel(); treeMain.id = Common.GuId(); treeMain.text = "Pre Sale Order"; treeMain.parentId = "0"; treeMain.value = "PreSaleOrder"; treeMain.isexpand = true; treeMain.complete = true; treeMain.hasChildren = true; treeList.Add(treeMain); #endregion foreach (ICSProductPreSellEntity item in data) { TreeViewModel tree = new TreeViewModel(); tree.id = item.F_Id; tree.text = item.PreSellNo + (item.IsConfirm == true ? "(Confirmed)" : ""); tree.value = item.PreSellNo; tree.parentId = treeMain.id; tree.isexpand = true; tree.complete = true; tree.hasChildren = false; treeList.Add(tree); } return Content(treeList.TreeViewJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetGridJson(string itemId, string keyword) { var data = preselldetialApp.GetList2(itemId, keyword); return Content(data.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetFormJson(string keyValue) { var data = maintainAppApp.GetForm(keyValue); return Content(data.ToJson()); } [HttpPost] [HandlerAjaxOnly] [HandlerAuthorize] [ValidateAntiForgeryToken] public ActionResult DeleteForm(string keyValue) { //获取选中的产品的ID数组 string[] array = keyValue.Split(','); List pList = new List(); foreach (string ppsdID in array) { ICSProductEntity entity = new ICSProductEntity(); entity.F_Id = preselldetialApp.GetForm(ppsdID).Product_Id; entity.IsLock = false; entity.InvQty = 1; pList.Add(entity); } preselldetialApp.DeleteForm(array, pList); return Success("Delete success."); } [HttpPost] [HandlerAjaxOnly] [HandlerAuthorize] [ValidateAntiForgeryToken] public ActionResult DeleteFormOrder(string keyValue) { presellApp.DeleteForm(keyValue); return Success("Delete success."); } } }