Esempio n. 1
0
        public ActionResult bomcostview(string type, int id)
        {
            if (type == "edit" && !Masterpage.CheckRight("bomcost_update"))
            {
                return(RedirectToAction("login", "account"));
            }
            if (type == "view" && !Masterpage.CheckRight("bomcost_view"))
            {
                return(RedirectToAction("login", "account"));
            }
            dynamic data    = new System.Dynamic.ExpandoObject();
            string  bomjson = "";
            var     one     = ServiceDB.Instance.QueryOneModel <V_BomCostModel>(" select * from V_BomCostModel  where bomid=" + id);
            var     child   = ServiceDB.Instance.QueryModelList <V_BomCostModel>(" select * from V_BomCostModel  where parent_Id=" + id).ToList();


            var list = bomService.GetChildBomCost(child, Convert.ToDouble(1), 1);

            //var virtuals=ServiceDB.Instance.QueryModelList<BomVirtual>("select * from BomVirtual where bomid=" + id).ToList();
            //if (virtuals != null && virtuals.Count > 0)
            //{
            //    List<object> nvs = new List<object>();
            //    foreach (var item in virtuals)
            //    {
            //        var nvi = new { km = 1, id = 0, sn = item.virtualId, no = "其他科目", name = item.virtualName, model = "", amount = item.vAmount, price = item.vPrice.ToString("N"), cost = (item.vPrice * item.vAmount).ToString("N"), unit = "", unit2 = "", amount2 = "", remark = item.remark, index = 0 };
            //        list.Add(nvi);


            //    }
            //    //var nv = new { km = 0, id = 0, sn = 0, no = "其他科目", name = "", model = "", amount = "", price = "", cost = "", unit = "", unit2 = "", amount2 = "", remark = "", index = 0, children = nvs };
            //    //list.Add(nv);

            //}
            bomjson      = JsonHelper.ToJson(list);
            data.one     = one;
            data.bomjson = bomjson;
            data.type    = type;
            return(View(data));
        }