Example #1
0
        public void Delete(System.Int32 id)
        {
            //var rCode = GetRoleCode();
            var temp = T_XSDDomain.GetInstance().GetModelById(id);

            if (temp != null)
            {
                if (temp.XSFLAG == 1)
                {
                    Response.Write("{\"statusCode\":\"300\", \"message\":\"已审批通过的数据不能删除!\"}");
                    return;
                }
                //如果销售单未被使用,超级管理员可删除。否则,任何人不能删除
                Expression <Func <T_CKD, bool> > where = p => (p.XSID == temp.XSID);
                var lst = T_CKDDomain.GetInstance().GetAllModels <int>(where);
                if (lst != null && lst.Count > 0)
                {
                    Response.Write("{\"statusCode\":\"300\", \"message\":\"该销售单已存在出库单,不能删除!\"}");
                    return;
                }
            }
            int result = T_XSDDomain.GetInstance().Delete(id);

            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_XSD/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
Example #2
0
        public ActionResult Save(System.Int32 id, string tag)
        {
            //加载购买商商企业列表
            T_CusQYModels cusQymode = new T_CusQYModels();

            cusQymode.DataModel = cusQymode.DataModel ?? new T_CusQY();

            cusQymode.DataList = T_CusQYDomain.GetInstance().GetAllT_CusQY(cusQymode.DataModel).Where(p => p.CusStatus == Convert.ToInt32("1")).ToList();

            ViewData["CusQY"] = new SelectList(cusQymode.DataList, "CusID", "CusMC");

            //加载销售人员列表
            T_PersonModels perQymode = new T_PersonModels();

            perQymode.DataModel = perQymode.DataModel ?? new T_Person();

            perQymode.DataList = T_PersonDomain.GetInstance().GetAllT_Person(perQymode.DataModel);

            ViewData["Person"] = new SelectList(perQymode.DataList, "PsMZ", "PsMZ");

            //加载销售合同列表
            //T_XSHTModels xshtQymode = new T_XSHTModels();

            //xshtQymode.DataModel = xshtQymode.DataModel ?? new T_XSHT();

            //xshtQymode.DataList = T_XSHTDomain.GetInstance().GetAllT_XSHT(xshtQymode.DataModel);

            //ViewData["XSHT"] = new SelectList(xshtQymode.DataList, "HTID", "HTMC");

            //加载产品列表
            T_YLCPModels ylcpmode = new T_YLCPModels();

            ylcpmode.DataModel = ylcpmode.DataModel ?? new T_YLCP();

            ylcpmode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpmode.DataModel).Where(p => p.CPStatus == 1).ToList();

            ViewData["YLCP"] = new SelectList(ylcpmode.DataList, "CPID", "CPMC");

            T_XSDModels model = new T_XSDModels();

            model.DataModel = new T_XSD();
            CurUser         = Session["UserModel"] as SysUser;
            if (id != 0)
            {
                model.DataModel = T_XSDDomain.GetInstance().GetModelById(id);
                model.XSMXList  = T_XSMXDomain.GetInstance().GetT_XSMXByXsid(id);
            }
            else
            {
                model.DataModel.XSDH   = T_XSDDomain.GetInstance().GetXsOrderNum(CurUser);
                model.DataModel.XSCJR  = CurUser.UserAccount;
                model.DataModel.XSCJRQ = DateTime.Now;
            }
            model.RoleCode = GetRoleCode();
            model.Tag      = tag;
            return(View("~/Views/T_XSD/Save.cshtml", model));
        }
Example #3
0
        public ActionResult Save(System.Int32 id, string tag)
        {
            CurUser = Session["UserModel"] as SysUser;
            T_CKDModels model = new T_CKDModels();
            //加载销售单列表
            T_XSDModels xsdmode = new T_XSDModels();

            xsdmode.DataModel = xsdmode.DataModel ?? new T_XSD();
            xsdmode.DataList  = T_XSDDomain.GetInstance().GetAllT_XSD(xsdmode.DataModel).Where(p => p.XSFLAG == Convert.ToInt32("1")).ToList();
            ViewData["XSD"]   = new SelectList(xsdmode.DataList, "XSID", "XSDH");

            //加载仓库列表
            T_CKModels ckmode = new T_CKModels();

            ckmode.DataModel = ckmode.DataModel ?? new T_CK();
            ckmode.DataList  = T_CKDomain.GetInstance().GetAllT_CK(ckmode.DataModel);
            ViewData["CK"]   = new SelectList(ckmode.DataList, "CKID", "CKMC");

            //加载产品列表
            T_YLCPModels ylcpQymode = new T_YLCPModels();

            ylcpQymode.DataModel = ylcpQymode.DataModel ?? new T_YLCP();
            ylcpQymode.DataList  = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpQymode.DataModel).Where(p => p.CPStatus == Convert.ToInt32("1")).ToList();
            ViewData["YLCP"]     = new SelectList(ylcpQymode.DataList, "CPID", "CPMC");

            //获取本企业下的人员列表
            T_Person person = new T_Person();

            person.PsQYID   = (int)CurUser.UserCompanyID;
            ViewBag.Persons = new SelectList(T_PersonDomain.GetInstance().GetAllT_Person(person), "PsMZ", "PsMZ");

            model.DataModel = new T_CKD();
            if (id != 0)
            {
                model.DataModel = T_CKDDomain.GetInstance().GetModelById(id);
                model.CKMXList  = T_CKMXDomain.GetInstance().GetT_CKMXByCkid(id);
                if (model.DataModel.XSID != null && model.DataModel.XSID != 0)
                {
                    var temp = T_XSDDomain.GetInstance().GetModelById(model.DataModel.XSID);
                    if (temp != null)
                    {
                        model.XSDH = temp.XSDH;
                    }
                }
            }
            else
            {
                model.DataModel.CKDH   = T_CKDDomain.GetInstance().GetCkOrderNum(CurUser);
                model.DataModel.CKCJR  = CurUser.UserAccount;
                model.DataModel.CKCJRQ = DateTime.Now;
            }
            model.Tag      = tag;
            model.RoleCode = GetRoleCode();
            return(View("~/Views/T_CKD/Save.cshtml", model));
        }
Example #4
0
        public int SaveTPrice(int id, string dh, string tPrice)
        {
            int result = 0;

            try
            {
                double d = 0;
                double.TryParse(tPrice, out d);
                result = T_XSDDomain.GetInstance().SaveTPrice(id, dh, d);
            }
            catch { }
            return(result);
        }
Example #5
0
        public JsonResult GetXsInfoByID(int id)
        {
            var tModel = T_XSDDomain.GetInstance().GetModelById(id);

            if (tModel != null)
            {
                string resultStr = JsonConvert.SerializeObject(new
                {
                    XSRY = tModel.XSRY,
                    XSRQ = tModel.XSRQ.HasValue ? tModel.XSRQ.Value.ToString("yyyy/MM/dd") : ""
                });
                return(Json(resultStr));
            }
            return(Json(""));
        }
Example #6
0
        public ActionResult Save(System.Int32 id, string tag)
        {
            T_XSMXModels model = new T_XSMXModels();

            model.DataModel = new T_XSMX();
            Int32 did = id;

            if (tag != "Add")
            {
                model.DataModel = T_XSMXDomain.GetInstance().GetModelById(id);
                did             = model.DataModel.XSID ?? 0;
            }
            //加载销售单列表
            T_XSDModels xsdmode = new T_XSDModels();

            xsdmode.DataModel = xsdmode.DataModel ?? new T_XSD();

            // xsdmode.DataList = T_XSDDomain.GetInstance().GetAllT_XSD(xsdmode.DataModel);



            //加载产品列表
            T_YLCPModels ylcpmode = new T_YLCPModels();

            ylcpmode.DataModel = ylcpmode.DataModel ?? new T_YLCP();

            ylcpmode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpmode.DataModel).Where(p => p.CPStatus == Convert.ToInt32("1")).ToList();

            ViewData["YLCP"] = new SelectList(ylcpmode.DataList, "CPID", "CPMC");



            T_XSD rkd = T_XSDDomain.GetInstance().GetModelById(did);

            xsdmode.DataList = new List <T_XSD>();
            xsdmode.DataList.Add(rkd);
            ViewData["XSD"] = new SelectList(xsdmode.DataList, "XSID", "XSMC");


            //if (id != 0)
            //{
            //    model.DataModel = T_XSMXDomain.GetInstance().GetModelById(id);
            //}
            model.Tag = tag;
            return(View("~/Views/T_XSMX/Save.cshtml", model));
        }
Example #7
0
        public void through(T_XSDModels model, int id)
        {
            int result = 0;

            try
            {
                Int32 xsdid = model.DataModel.XSID;
                result = T_XSDDomain.GetInstance().Sh(xsdid, id);
            }
            catch { }
            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_XSD/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
Example #8
0
        public void Save(T_XSDModels model)
        {
            int result = 0;

            try
            {
                if (model.Tag == "Add")
                {
                    model.DataModel.XSFLAG   = 0;
                    model.DataModel.IsFinish = 0;

                    var temp = T_XSDDomain.GetInstance().GetAllModels <string>(p => p.XSDH == model.DataModel.XSDH).FirstOrDefault();
                    if (temp != null && temp.XSID != 0)
                    {
                        var CurUser1 = Session["UserModel"] as SysUser;
                        model.DataModel.XSDH = T_XSDDomain.GetInstance().GetXsOrderNum(CurUser1);
                    }

                    result = T_XSDDomain.GetInstance().AddModel(model.DataModel);
                }
                else if (model.Tag == "Edit")
                {
                    model.DataModel.XSFLAG   = 0;
                    model.DataModel.IsFinish = 0;
                    result = T_XSDDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.XSID);
                }
            }
            catch { }
            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_XSD/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
Example #9
0
        public ActionResult XSDSPIndex(System.Int32 id, string tag)
        {
            //加载购买商商企业列表
            T_CusQYModels cusQymode = new T_CusQYModels();

            cusQymode.DataModel = cusQymode.DataModel ?? new T_CusQY();

            cusQymode.DataList = T_CusQYDomain.GetInstance().GetAllT_CusQY(cusQymode.DataModel).Where(p => p.CusStatus == Convert.ToInt32("1")).ToList();

            ViewData["CusQY"] = new SelectList(cusQymode.DataList, "CusID", "CusMC");

            //加载销售人员列表
            T_PersonModels perQymode = new T_PersonModels();

            perQymode.DataModel = perQymode.DataModel ?? new T_Person();

            perQymode.DataList = T_PersonDomain.GetInstance().GetAllT_Person(perQymode.DataModel);

            ViewData["Person"] = new SelectList(perQymode.DataList, "PsID", "PsMZ");

            T_XSDModels model = new T_XSDModels();

            model.DataModel = new T_XSD();
            T_XSMX xsmodel = new T_XSMX();

            if (id != 0)
            {
                model.DataModel = T_XSDDomain.GetInstance().GetModelById(id);
                model.XSMXList  = T_XSMXDomain.GetInstance().GetAllT_XSMX(xsmodel);
                if (model.XSMXList.Count > 0)
                {
                    model.XSMXList = model.XSMXList.Where(p => p.XSID == id).ToList();
                }
            }
            model.Tag = tag;
            return(View("~/Views/T_XSD/XSDSPIndex.cshtml", model));
        }
Example #10
0
        public ActionResult Index(T_XSDModels evalModel)
        {
            SysUser UserModel = Session["UserModel"] as SysUser;

            try
            {
                ViewData["shUserId"]  = UserModel.UserId;
                evalModel.currentPage = int.Parse(Request["pageNum"].ToString());
            }
            catch { }
            string order = "";

            try
            {
                order = Request["orderField"].ToString();
            }
            catch { }

            if (order.Trim() == "${param.orderField}")
            {
                order = "";
            }
            int pagesize    = Convert.ToInt32(evalModel.pageSize);
            int pagecount   = Convert.ToInt32(evalModel.pagecount);
            int currentPage = Convert.ToInt32(evalModel.currentPage);

            evalModel.DataModel = evalModel.DataModel ?? new T_XSD();
            string strCUSQY = "请选择";

            if (Request["strXSDH"] != null)
            {
                string str = Request["strXSDH"].ToString();
                if (!String.IsNullOrEmpty(str))
                {
                    evalModel.DataModel.XSDH = str;
                }
            }
            if (Request["strXSDMC"] != null)
            {
                string str = Request["strXSDMC"].ToString();
                if (!String.IsNullOrEmpty(str))
                {
                    evalModel.DataModel.XSMC = str;
                }
            }
            if (Request["strCUSQY"] != null)
            {
                strCUSQY = Request["strCUSQY"].ToString();
                if (!String.IsNullOrEmpty(strCUSQY))
                {
                    evalModel.DataModel.KHID = Convert.ToInt16(strCUSQY);
                }
            }
            var strXSPerson = "";

            if (Request["strXSPerson"] != null)
            {
                strXSPerson = Request["strXSPerson"].ToString();
                if (!String.IsNullOrEmpty(strXSPerson))
                {
                    evalModel.DataModel.XSRY = strXSPerson;
                }
            }
            ViewData["strXSPerson"] = strXSPerson;
            var cpId = 0;

            if (Request["strXSCPMC"] != null)
            {
                string str = Request["strXSCPMC"].ToString();
                if (!String.IsNullOrEmpty(str))
                {
                    cpId = Convert.ToInt32(str);
                }
                ViewData["strXSCPMC"] = str;
            }
            var cusId = 0;

            if (Request["strXSCusQY"] != null)
            {
                string str = Request["strXSCusQY"].ToString();
                if (!String.IsNullOrEmpty(str))
                {
                    cusId = Convert.ToInt32(str);
                }
                ViewData["strXSCusQY"] = str;
            }

            //购货企业列表
            T_CusQY cusqy = new T_CusQY();

            ViewBag.CUSQY        = new SelectList(T_CusQYDomain.GetInstance().GetAllT_CusQY(cusqy).Where(p => p.CusStatus == 1).ToList(), "CusID", "CusMC");
            ViewData["strCUSQY"] = strCUSQY;

            //获取本企业下的人员列表
            T_Person person = new T_Person();

            person.PsQYID   = (int)UserModel.UserCompanyID;
            ViewBag.Persons = new SelectList(T_PersonDomain.GetInstance().GetAllT_Person(person), "PsMZ", "PsMZ");

            T_SupQYModels supmode = new T_SupQYModels();

            supmode.DataModel     = supmode.DataModel ?? new T_SupQY();
            supmode.DataList      = T_SupQYDomain.GetInstance().GetAllT_SupQY(supmode.DataModel).Where(p => p.SupStatus == 1).ToList();
            ViewData["SupQYList"] = new SelectList(supmode.DataList, "SupID", "SupMC");
            T_YLCPModels ylcpQymode = new T_YLCPModels();

            ylcpQymode.DataModel = ylcpQymode.DataModel ?? new T_YLCP();
            ylcpQymode.DataList  = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpQymode.DataModel).Where(p => p.CPStatus == 1).ToList();
            ViewData["YLCP"]     = new SelectList(ylcpQymode.DataList, "CPID", "CPMC");

            evalModel.DataList    = T_XSDDomain.GetInstance().PageT_XSD(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, cpId, cusId, out pagecount, out resultCount);
            evalModel.resultCount = resultCount;
            return(View("~/Views/T_XSD/Index.cshtml", evalModel));
        }
Example #11
0
        /// <summary>
        /// 获取提示信息
        /// </summary>
        public string GetTipInfo()
        {
            var strHtml = new StringBuilder();
            Expression <Func <ActivityInfo, bool> > whereActivityInfo = p => (p.EndTime != null && DateTime.Now <= p.EndTime.Value);

            whereActivityInfo = whereActivityInfo.And(p => p.StartTime != null && DateTime.Now >= p.StartTime.Value);
            var ActivityInfoCount = ActivityInfoDomain.GetInstance().GetAllModels <int>(whereActivityInfo).Count; //有效的公告数量

            var AlarmCount = T_BJDDomain.GetInstance().GetCount();                                                //报警数量

            if (AlarmCount > 0)
            {
                strHtml.Append(string.Format(strTemplete, "alarmManage", "/T_BJD/Index/", "预警通知", AlarmCount, "报警"));
            }
            if (ActivityInfoCount > 0)
            {
                strHtml.Append(string.Format(strTemplete, "ActivityInfoManage", "/ActivityInfo/Index/", "公告管理", ActivityInfoCount, "公告"));
            }
            var RoleCode = GetRoleCode();

            if (RoleCode == "2")
            {
                #region
                Expression <Func <T_SupQY, bool> > whereSupQY = p => p.SupStatus == 0;
                var SupQYCount = T_SupQYDomain.GetInstance().GetAllModels <int>(whereSupQY).Count; //待审批的供货企业数量

                Expression <Func <T_YLCP, bool> > whereYLCP = p => p.CPStatus == 0;
                var YLCPCount = T_YLCPDomain.GetInstance().GetAllModels <int>(whereYLCP).Count; //待审批的医疗产品数量

                Expression <Func <T_CusQY, bool> > whereCusQY = p => p.CusStatus == 0;
                var CusQYCount = T_CusQYDomain.GetInstance().GetAllModels <int>(whereCusQY).Count; //待审批的购货企业数量

                Expression <Func <T_CGD, bool> > whereCGD = p => p.ISSH == 0;
                var CGDCount = T_CGDDomain.GetInstance().GetAllModels <int>(whereCGD).Count; //待审批的采购单数量

                Expression <Func <T_RKD, bool> > whereRKD = p => p.ISSH == 0;
                var RKDCount = T_RKDDomain.GetInstance().GetAllModels <int>(whereRKD).Count; //待审批的入库单数量

                Expression <Func <T_XSD, bool> > whereXSD = p => p.XSFLAG == 0;
                var XSDCount = T_XSDDomain.GetInstance().GetAllModels <int>(whereXSD).Count; //待审批的销售单数量

                Expression <Func <T_SHD, bool> > whereSHD = p => p.ISSH == 0;
                var SHDCount = T_SHDDomain.GetInstance().GetAllModels <int>(whereSHD).Count; //待审批的损耗单数量

                Expression <Func <T_THD, bool> > whereTHD = p => p.ISSH == 0;
                var THHDCount = T_THDDomain.GetInstance().GetAllModels <int>(whereTHD).Count; //待审批的退货单数量

                if (SupQYCount > 0)
                {
                    strHtml.Append(string.Format(strTemplete, "SupQYManage", "/T_SupQY/Index/", "供货企业", SupQYCount, "供货企业待审批"));
                }
                if (YLCPCount > 0)
                {
                    strHtml.Append(string.Format(strTemplete, "YLCPManage", "/T_YLCP/Index/", "产品信息", YLCPCount, "产品待审批"));
                }
                if (CusQYCount > 0)
                {
                    strHtml.Append(string.Format(strTemplete, "CusQYManage", "/T_CusQY/Index/", "购货企业", CusQYCount, "购货企业待审批"));
                }
                if (CGDCount > 0)
                {
                    strHtml.Append(string.Format(strTemplete, "CGDManage", "/T_CGD/Index/", "采购管理", CGDCount, "采购单待审批"));
                }
                if (RKDCount > 0)
                {
                    strHtml.Append(string.Format(strTemplete, "RKDManage", "/T_RKD/Index/", "入库管理", RKDCount, "入库单待审批"));
                }
                if (XSDCount > 0)
                {
                    strHtml.Append(string.Format(strTemplete, "XSDManage", "/T_XSD/Index/", "销售管理", XSDCount, "销售单待审批"));
                }
                if (SHDCount > 0)
                {
                    strHtml.Append(string.Format(strTemplete, "SHDManage", "/T_SHD/Index/", "损耗管理", SHDCount, "损耗单待审批"));
                }
                if (THHDCount > 0)
                {
                    strHtml.Append(string.Format(strTemplete, "THDManage", "/T_THD/Index/", "退货管理", THHDCount, "退货单待审批"));
                }
                #endregion
            }
            return(strHtml.ToString());
        }