Ejemplo n.º 1
0
        public JsonResult GetSelectTreeID(StoreTreeNameRequests request, FormCollection collection)
        {
            bool isParent   = bool.Parse(collection["isParent"]);
            var  dataString = collection["id"].ToString();

            this.treeID      = dataString;
            request.treeID   = new Guid(dataString);
            request.PageSize = 100;
            //Guid id = new Guid(dataString);
            this.TempData["treeid"] = dataString;
            if (!isParent)
            {
                ModelState.Clear();
                var result = this.StoreService.GetNodeProperty(request);
                ViewData.ModelState.Remove("userPwd");
                ModelState.AddModelError("userPwd", "请输入密码aaaaaaaaaaaaaaa!");
                List <DictionaryProperty> resultList = new List <DictionaryProperty>();
                foreach (DictionaryProperty dp in result)
                {
                    resultList.Add(dp);
                }
                return(Json(resultList, JsonRequestBehavior.AllowGet));
            }

            else
            {
                JsonResult json = new JsonResult
                {
                    Data = "ParentNode"
                };
                return(Json(json));
            }
        }
Ejemplo n.º 2
0
        public PartialViewResult Delete(string ids, FormCollection collection)
        {
            string[]    strarr  = ids.Split(',');
            List <Guid> dellist = new List <Guid>();

            foreach (var i in strarr)
            {
                if (i.Length == 36)
                {
                    Guid delID = new Guid(i);
                    dellist.Add(delID);
                }
            }
            this.StoreService.DeleteProperty(dellist);

            string id   = collection["treeItemID"].ToString();
            Guid   dpid = new Guid(id);
            StoreTreeNameRequests request = new StoreTreeNameRequests();

            request.treeID   = dpid;
            request.PageSize = 500;
            var model = this.StoreService.GetNodeProperty(request);

            return(PartialView("_DPropertyPartialPage", model));
        }
Ejemplo n.º 3
0
        public PartialViewResult AddProperty(StoreTreeNameRequests request, FormCollection collection)
        {
            var model = new DictionaryProperty();

            this.TryUpdateModel <DictionaryProperty>(model);

            string id = null;

            if (this.TempData.ContainsKey("treeid"))
            {
                id = this.TempData["treeid"].ToString();
                //TempData.Remove("treeid");
                request.treeID = new Guid(id.ToString());
            }

            if (id != null)
            {
                Guid treeid = new Guid(id);
                Guid keyid  = Guid.NewGuid();
                model.leaf_id = treeid;
                model.dpid    = keyid;
            }
            this.StoreService.SaveDictionaryProperty(model);
            //Dictionary<string, string> dp = new Dictionary<string, string>();
            //dp.Add("clmc", model.clmc);
            //dp.Add("pm", model.pm);
            //dp.Add("mf", model.mf);
            //dp.Add("js", model.js);
            request.PageSize = 500;
            var result = this.StoreService.GetNodeProperty(request);

            return(PartialView("_DPropertyPartialPage", result));
        }
Ejemplo n.º 4
0
        public ActionResult GetID(StoreTreeNameRequests request)
        {
            var dataString = "8b0bdde6-7f59-4dc2-acc5-6216dfdc973d";

            request.treeID = new Guid(dataString);
            //Guid id = new Guid(dataString);
            this.TempData["treeid"] = dataString;
            var result = this.StoreService.GetNodeProperty(request);

            return(View(result));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取节点属性
        /// </summary>
        /// <param name="id">节点ID</param>
        /// <returns></returns>
        public IEnumerable <DictionaryProperty> GetNodeProperty(StoreTreeNameRequests request)
        {
            request = request ?? new StoreTreeNameRequests();
            using (var dbContext = new StoreDbContext())
            {
                IQueryable <DictionaryProperty> dps = dbContext.DictionaryProperty;
                if (request.treeID != null)
                {
                    dps = dps.Where(u => u.leaf_id == request.treeID);
                }

                return(dps.OrderBy(u => u.CreateTime).ToPagedList(request.PageIndex, request.PageSize));
            }
        }
Ejemplo n.º 6
0
        public PartialViewResult EditProperty(StoreTreeNameRequests request, FormCollection collection)
        {
            string id    = collection["dpid"].ToString();
            Guid   dpid  = new Guid(id);
            var    model = this.StoreService.GetDictionaryProperty(dpid);

            this.TryUpdateModel <DictionaryProperty>(model);

            this.StoreService.SaveEditProperty(model);
            string leafid = model.leaf_id.ToString();

            request.treeID   = new Guid(leafid);
            request.PageSize = 500;
            var result = this.StoreService.GetNodeProperty(request);

            return(PartialView("_DPropertyPartialPage", result));
        }
Ejemplo n.º 7
0
        public PartialViewResult DPropertyPartialPage(StoreTreeNameRequests request, FormCollection collection)
        {
            bool isParent   = bool.Parse(collection["isParent"]);
            var  dataString = collection["id"].ToString();

            this.treeID      = dataString;
            request.treeID   = new Guid(dataString);
            request.PageSize = 500;
            //Guid id = new Guid(dataString);
            this.TempData["treeid"] = dataString;
            if (!isParent)
            {
                var result = this.StoreService.GetNodeProperty(request);
                return(PartialView("_DPropertyPartialPage", result));
            }
            else
            {
                return(PartialView("_DPropertyPartialPage"));
            }
        }
Ejemplo n.º 8
0
        public ActionResult ReturnOrder(FormCollection collection)
        {
            if (collection.AllKeys.Contains("DictionaryProperty.dpid"))
            {
                StoreTableRequest request = new StoreTableRequest();
                request.PageSize = 1000;
                request.Gid      = new Guid(collection["DictionaryProperty.dpid"]);
                int OutProductNumber = int.Parse(collection["OutBoundCount"]); //出库订单件数
                var result           = this.StoreService.GetStoreList(request);

                //获取订单下所有材料
                StoreTreeNameRequests stnRequest = new StoreTreeNameRequests();
                stnRequest.PageSize = 1000;
                stnRequest.treeID   = request.Gid;
                var clResultList = this.StoreService.GetNodeProperty(stnRequest);
                //循环材料列表,如果在StoreTable中存在更新其数量,如果不在插入数据
                foreach (DictionaryProperty dp in clResultList)
                {
                    StoreTable st = new StoreTable();
                    st.number        = 0;
                    st.number        = st.number + (dp.js.Value * Convert.ToDecimal(OutProductNumber));
                    st.store_item_id = dp.dpid;


                    InBoundRecord ibr = new InBoundRecord();
                    //插入数据到入库记录表
                    ibr.inbound_id = st.store_item_id;
                    ibr.rkid       = Guid.NewGuid();
                    ibr.number     = dp.js.Value * Convert.ToDecimal(OutProductNumber);
                    ibr.boundtype  = "还库材料";
                    ibr.khmc       = this.StoreService.GetParentNameByLeafID(dp.leaf_id.Value);
                    this.StoreService.InsertInboundRecord(ibr);
                    this.StoreService.InsertStoreItem(st);
                }
            }
            return(this.RefreshParent());
        }
Ejemplo n.º 9
0
        public ActionResult Create(FormCollection collection)
        {
            if (collection.AllKeys.Contains("DictionaryProperty.dpid"))
            {
                StoreTableRequest request = new StoreTableRequest();
                request.PageSize = 10000;
                request.Gid      = new Guid(collection["DictionaryProperty.dpid"]);
                int OutProductNumber;
                if (!int.TryParse(collection["OutBoundCount"], out OutProductNumber))
                {
                    var model = new StoreTable();
                    return(View("OutBoundEdit", model));
                }
                var lydw = collection["employment"];
                ///
                var  result = this.StoreService.GetStoreList(request);
                Guid tempid = new Guid();//订单ID,出库记录表用
                //获取订单下所有材料
                StoreTreeNameRequests stnRequest = new StoreTreeNameRequests();
                stnRequest.PageSize = 1000;
                stnRequest.treeID   = request.Gid;
                var dpLists = this.StoreService.GetNodeProperty(stnRequest);
                foreach (DictionaryProperty dp in dpLists)
                {
                    var storeItem = this.StoreService.ExistDPInStore(dp);
                    tempid = dp.leaf_id.Value;
                    //判断store里是否有dp
                    if (storeItem == null)
                    {
                        StoreTable st = new StoreTable();
                        st.number        = 0;
                        st.number        = st.number - (dp.js.Value * Convert.ToDecimal(OutProductNumber));
                        st.store_item_id = dp.dpid;

                        InBoundRecord ibr = new InBoundRecord();
                        //插入数据到入库记录表
                        ibr.inbound_id = st.store_item_id;
                        ibr.rkid       = Guid.NewGuid();
                        ibr.number     = dp.js.Value * Convert.ToDecimal(OutProductNumber);
                        ibr.boundtype  = "出库材料";
                        ibr.employment = lydw;
                        ibr.khmc       = this.StoreService.GetParentNameByLeafID(dp.leaf_id.Value);
                        this.StoreService.InsertInboundRecord(ibr);

                        //出库
                        this.StoreService.InsertStoreItem(st);
                    }
                    else//有StoreItem
                    {
                        storeItem.number = storeItem.number - (dp.js.Value * Convert.ToDecimal(OutProductNumber));

                        InBoundRecord ibr = new InBoundRecord();
                        //插入数据到入库记录表
                        ibr.inbound_id = storeItem.store_item_id;
                        ibr.rkid       = Guid.NewGuid();
                        ibr.number     = dp.js.Value * Convert.ToDecimal(OutProductNumber);
                        ibr.boundtype  = "出库材料";
                        ibr.employment = lydw;
                        ibr.khmc       = this.StoreService.GetParentNameByLeafID(storeItem.DictionaryProperty.leaf_id.Value);
                        this.StoreService.InsertInboundRecord(ibr);

                        //出库
                        this.StoreService.OutBoundItem(storeItem);
                    }
                    //
                }
                //插入到出库记录表
                OutBoundRecord obr = new OutBoundRecord();
                obr.ckid       = Guid.NewGuid();
                obr.node_id    = tempid;
                obr.employment = lydw;
                obr.number     = OutProductNumber;
                this.StoreService.InsertOutBoundRecord(obr);
            }
            return(this.RefreshParent());
        }
Ejemplo n.º 10
0
        /// <summary>
        /// EXCEL材料导入
        /// </summary>
        /// <param name="request"></param>
        /// <param name="Filedata"></param>
        /// <returns></returns>
        public PartialViewResult UploadFile(StoreTreeNameRequests request, HttpPostedFileBase Filedata, string treeidt)
        {
            // 如果没有上传文件
            if (Filedata == null ||
                string.IsNullOrEmpty(Filedata.FileName) ||
                Filedata.ContentLength == 0)
            {
                //return this.HttpNotFound();
            }

            // 保存到 ~/photos 文件夹中,名称不变
            string filename    = System.IO.Path.GetFileName(Filedata.FileName);
            string virtualPath =
                string.Format("~/UploadFiles/{0}", filename);
            // 文件系统不能使用虚拟路径
            string path = this.Server.MapPath(virtualPath);

            Filedata.SaveAs(path);

            var    model = new DictionaryProperty();
            string id    = null;

            if (this.TempData.ContainsKey("treeid"))
            {
                id = this.TempData["treeid"].ToString();
                //TempData.Remove("treeid");
                request.treeID = new Guid(id.ToString());
            }

            if (treeidt != null)
            {
                Guid treeid = new Guid(treeidt);
                request.treeID = treeid;
                model.leaf_id  = treeid;
            }
            DataTable dt = this.StoreService.ReadExcel(path);

            foreach (DataRow row in dt.Rows)
            {//判断exel数据异常返回,不存数据
                var clmc = row[0].ToString();
                var pm   = row[1].ToString();
                var mf   = row[2].ToString();
                if (row[3].ToString() == "" || row[3].ToString() == null)
                {
                    row[3] = 1;
                }
                var temp = decimal.Parse(row[3].ToString());
            }
            foreach (DataRow row in dt.Rows)
            {
                Guid keyid = Guid.NewGuid();
                model.dpid = keyid;
                model.clmc = row[0].ToString();
                model.pm   = row[1].ToString();
                model.mf   = row[2].ToString();
                model.js   = decimal.Parse(row[3].ToString());
                this.StoreService.SaveDictionaryProperty(model);
            }

            //Dictionary<string, string> dp = new Dictionary<string, string>();
            //dp.Add("clmc", model.clmc);
            //dp.Add("pm", model.pm);
            //dp.Add("mf", model.mf);
            //dp.Add("js", model.js);
            request.PageSize = 500;
            var result = this.StoreService.GetNodeProperty(request);

            return(PartialView("_DPropertyPartialPage", result));
        }
Ejemplo n.º 11
0
        public ActionResult Index(StoreTreeNameRequests request)
        {
            var result = this.StoreService.GetNodeProperty(request);

            return(View(result));
        }