コード例 #1
0
        public ActionResult Index(T_CKMXModels evalModel, string id)
        {
            try
            {
                evalModel.currentPage = int.Parse(Request["pageNum"].ToString());
            }
            catch { }
            string order = "";

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

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

            evalModel.DataModel   = evalModel.DataModel ?? new T_CKMX();
            evalModel.DataList    = T_CKMXDomain.GetInstance().PageT_CKMX(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount).Where(p => p.CKDID == int.Parse(id)).ToList();
            evalModel.resultCount = resultCount;
            ViewData["ParaStr"]   = ExportExcelPR(int.Parse(id));
            return(View("~/Views/T_CKMX/Index.cshtml", evalModel));
        }
コード例 #2
0
        public void Save(T_CKMXModels model)
        {
            int    result = 0;
            string guid   = string.Empty;

            try
            {
                if (model.Tag == "Add")
                {
                    model.DataModel.GUID = Guid.NewGuid().ToString("N");
                    guid   = model.DataModel.GUID;
                    result = T_CKMXDomain.GetInstance().AddModelByCkdh(model.DataModel, model.CKDH);
                }
                else if (model.Tag == "Edit")
                {
                    result = T_CKMXDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.CKMID);
                }
            }
            catch { }
            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_CKD/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
コード例 #3
0
        public void Delete(System.Int32 id)
        {
            var temp = T_CKDDomain.GetInstance().GetModelById(id);

            if (temp != null)
            {
                var lstMX = T_CKMXDomain.GetInstance().GetT_CKMXByCkid(temp.CKID);
                if (lstMX != null && lstMX.Count > 0)
                {
                    Response.Write("{\"statusCode\":\"300\", \"message\":\"该数据不能删除!\"}");
                    return;
                }
            }
            int result = T_CKDDomain.GetInstance().Delete(id);

            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_CKD/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
コード例 #4
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));
        }
コード例 #5
0
        public ActionResult Save(System.Int32 id, string tag)
        {
            T_CKMXModels model = new T_CKMXModels();

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

            if (tag != "Add")
            {
                model.DataModel = T_CKMXDomain.GetInstance().GetModelById(id);
                did             = model.DataModel.CKDID ?? 0;
            }
            //加载仓库列表
            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_CKDModels ckdQymode = new T_CKDModels();

            ckdQymode.DataModel = ckdQymode.DataModel ?? new T_CKD();

            T_CKD ckd = T_CKDDomain.GetInstance().GetModelById(did);

            ckdQymode.DataList = new List <T_CKD>();
            ckdQymode.DataList.Add(ckd);
            ViewData["CKD"] = new SelectList(ckdQymode.DataList, "CKID", "CKMC");



            //if (id != 0)
            //{
            //    model.DataModel = T_CKMXDomain.GetInstance().GetModelById(id);
            //}
            model.Tag = tag;
            return(View("~/Views/T_CKMX/Save.cshtml", model));
        }
コード例 #6
0
        public void Delete(string guid)
        {
            int result = T_CKMXDomain.GetInstance().DeleteModelByGuid(guid);

            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_CKD/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
コード例 #7
0
        public ActionResult CKMXTable(System.Int32 id, string ckdh, int canEdit)
        {
            T_CKDModels model = new T_CKDModels();

            if (id != 0)
            {
                model.CKMXList = T_CKMXDomain.GetInstance().GetT_CKMXByCkid(id);
            }
            else
            {
                model.CKMXList = T_CKMXDomain.GetInstance().GetT_CKMXByCkdh(ckdh);
            }
            model.RoleCode       = GetRoleCode();
            model.DataModel      = new T_CKD();
            model.DataModel.CKID = id;
            return(View("~/Views/T_CKMX/CKMXTable.cshtml", model));
        }
コード例 #8
0
ファイル: T_CKController.cs プロジェクト: gzl118/YLQX
        public void Delete(System.Int32 id)
        {
            Expression <Func <T_RKMX, bool> > where = p => (p.CKID == id);
            var lst = T_RKMXDomain.GetInstance().GetAllModels <int>(where);

            if (lst != null && lst.Count > 0)
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"该仓库已有入库数据,不能删除!\"}");
                return;
            }
            Expression <Func <T_CKMX, bool> > whereCKMX = p => (p.CKID == id);
            var lstCKMX = T_CKMXDomain.GetInstance().GetAllModels <int>(whereCKMX);

            if (lstCKMX != null && lstCKMX.Count > 0)
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"该仓库已有出库数据,不能删除!\"}");
                return;
            }

            Expression <Func <T_KC, bool> > whereKC = p => (p.CKID == id);
            var lstKC = T_KCDomain.GetInstance().GetAllModels <int>(whereKC);

            if (lstKC != null && lstKC.Count > 0)
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"该仓库已有库存数据,不能删除!\"}");
                return;
            }

            int result = T_CKDomain.GetInstance().DeleteModelById(id);

            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_CK/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
コード例 #9
0
        public string ExportExcelPR(System.Int32 id)
        {
            //接收需要导出的数据
            T_CKD ckdinfo = new T_CKD();

            List <T_CKD> list = T_CKDDomain.GetInstance().GetListModelById(id);

            if (list.Count > 0)
            {
                ckdinfo = list[0];
            }

            int xsqyid = ckdinfo.T_XSD.KHID ?? 0;

            T_CusQY cusqy = T_CusQYDomain.GetInstance().GetModelById(xsqyid);
            //客户企业名称
            string xsqyName = cusqy.CusMC;

            List <T_CKMX> ckmxList = T_CKMXDomain.GetInstance().GetListModelById(id);

            //命名导出表格的StringBuilder变量
            StringBuilder sHtml = new StringBuilder(string.Empty);

            //打印表头
            sHtml.Append("<table border=\"0\" width=\"100%\">");
            sHtml.Append("<tr height=\"40\"><td colspan=\"10\" align=\"center\" style='font-size:24px'><b>出库单" + "</b></td></tr>");
            sHtml.Append("<tr height=\"40\"><td colspan=\"8\" align=\"left\">购买单位:" + xsqyName + "</td><td align=\"right\">日期:" + DateTime.Now.ToString("yyyy-MM-dd") + "</td><td align=\"right\">单据编号:" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + "</td></tr>");
            sHtml.Append("</table>");
            sHtml.Append("<table border=\"1\" width=\"100%\">");
            //sHtml.Append("<tr height=\"40\"><td colspan=\"10\" align=\"center\" style='font-size:24px'><b>出库单" + "</b></td></tr>");
            //sHtml.Append("<tr height=\"40\"><td colspan=\"8\" align=\"left\">&nbsp;购买单位:" + xsqyName + "</td><td align=\"right\">日期:" + DateTime.Now.ToString("yyyy-MM-dd") + "</td><td align=\"right\">单据编号:" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + "</td></tr>");
            //打印列名
            sHtml.Append("<tr height=\"30\" align=\"center\" ><td>商品名称</td><td>规格</td><td>生产厂家</td><td>单位</td><td>数量</td><td>单价</td>"
                         + "<td>金额</td><td>批号</td><td>生产日期</td><td>注册证号</td></tr>");

            //合计
            double total = 0.0;

            for (int i = 0; i < ckmxList.Count; i++)
            {
                T_CKMX ckmx = ckmxList[i];
                //产品名称
                string cpName = ckmx.T_YLCP.CPMC;
                //规格
                string cpGg = ckmx.T_YLCP.CPGG ?? "";
                //单位
                string cpDw = ckmx.T_YLCP.CPDW ?? "";
                //数量
                double cpDj = ckmx.CPNUM ?? 0;
                //生成批号
                string scPh = ckmx.T_YLCP.CPPH ?? "";
                //生产日期
                string scRq = "";
                if (ckmx.T_YLCP.CPSCSJ != null)
                {
                    scRq = ckmx.T_YLCP.CPSCSJ.Value.ToLongDateString();
                }

                //生产企业
                string cpScqy = ckmx.T_YLCP.CPSCQY ?? "";
                //单价
                double cpPrice = ckmx.T_YLCP.CPPrice ?? 0.0;
                //产品总价
                double rowTotal = cpDj * cpPrice;

                total = total + rowTotal;
                //注册证号
                string cpzczh = ckmx.T_YLCP.CPZCZ;

                sHtml.Append("<tr height=\"30\" align=\"center\"><td>" + cpName
                             + "</td><td>" + cpGg + "</td><td>" + cpScqy
                             + "</td><td>" + cpDw + "</td><td>" + cpDj.ToString()
                             + "</td><td>" + cpPrice.ToString() + "</td><td>" + rowTotal.ToString() + "</td><td>" + scPh + "</td><td>" + scRq
                             + "</td><td>" + cpzczh
                             + "</td></tr>");
            }
            //循环读取List集合
            for (int i = 0; i < list.Count; i++)
            {
            }
            //打印表尾
            sHtml.Append("<tr height=\"40\" align=\"center\"><td>合计:</td><td colspan=\"9\">" + total + "</td></tr>");
            sHtml.Append("</table>");
            sHtml.Append("<table  border=\"0\" width=\"100%\">");
            sHtml.Append("<tr height=\"40\" align=\"center\"><td colspan=\"7\" align=\"left\">制单人:&nbsp;&nbsp</td><td align=\"right\">审核人:&nbsp;&nbsp</td><td align=\"right\">发货人:&nbsp;&nbsp</td><td align=\"center\">销售员:&nbsp;&nbsp</td></tr>");
            sHtml.Append("</table>");
            //调用输出Excel表的方法
            return(sHtml.ToString());
            //ExportToExcel("application/vnd.ms-excel", "出库单.xls", sHtml.ToString());
        }
コード例 #10
0
        public string ExportExcelPR2(System.Int32 id)
        {
            //获取需要打印的数据
            T_CKD ckdinfo = new T_CKD();

            List <T_CKD> list = T_CKDDomain.GetInstance().GetListModelById(id);

            if (list.Count > 0)
            {
                ckdinfo = list[0];
            }

            int xsqyid = 0;

            if (ckdinfo.T_XSD != null && ckdinfo.T_XSD.KHID.HasValue)
            {
                xsqyid = ckdinfo.T_XSD.KHID.Value;
            }

            T_CusQY cusqy = T_CusQYDomain.GetInstance().GetModelById(xsqyid);
            //购货企业名称
            string xsqyName = (cusqy != null && !string.IsNullOrEmpty(cusqy.CusMC)) ? cusqy.CusMC : "";
            string xsqyKFDZ = (cusqy != null) ? cusqy.CusKFDZ : ""; //库房地址

            List <T_CKMX> ckmxList = T_CKMXDomain.GetInstance().GetListModelById(id);
            T_WhsQY       qy       = new T_WhsQY();

            Expression <Func <T_WhsQY, bool> > where = PredicateBuilder.True <T_WhsQY>();
            var lst = T_WhsQYDomain.GetInstance().GetAllModels <int>(where);

            if (lst != null && lst.Count > 0)
            {
                qy = lst[0];
            }
            //命名导出表格的StringBuilder变量
            StringBuilder sHtml = new StringBuilder(string.Empty);

            //打印表头
            sHtml.Append("<table style='border-collapse:collapse;' rull='all'>");
            sHtml.Append("<tr height=\"40\"><td colspan=\"12\" align=\"center\" style='font-size:24px;border:0px;'>" + qy.WhsMC + "销售复核出库单" + "</td></tr>");
            sHtml.Append("<tr height=\"40\"><td colspan=\"5\" align=\"left\" style='border:0px;'>购货单位:" + xsqyName + "</td><td align=\"left\"  colspan=\"3\" style='border:0px;'>日 期:" + DateTime.Now.ToString("yyyy-MM-dd") + "</td><td align=\"center\"  colspan=\"4\" style='border:0px;'>单据编号:" + DateTime.Now.ToString("yyyyMMddHHmmss") + "</td></tr>");
            sHtml.Append("<tr><td colspan=\"12\" height=\"30\" style='border:0px;'>地址:" + xsqyKFDZ + "</td></tr>");
            sHtml.Append("<tr align=\"center\" ><td style='width: 100px;' >产品名称</td><td style='width: 40px;' >规格</td><td style='width: 40px;' >型号</td><td style='width:128px;' >生产企业</td><td style='width: 35px;' >单位</td><td style='width: 35px;' >数量</td><td style='width: 70px;' >产品批号</td><td style='width: 65px;'>生产日期\r\n--------\r\n失效日期</td><td style='width: 65px;' >生产/经营\r\n许可证号</td><td style='width: 60px;' >注册证号</td><td style='width: 35px;' >储运条件</td><td style='width: 32px;border-right: thin solid black;' >备注</td></tr>");

            //合计
            double total    = 0.0;
            double NumCpNum = 0.0;

            for (int i = 0; i < ckmxList.Count; i++)
            {
                T_CKMX ckmx = ckmxList[i];
                //产品名称
                string cpName = ckmx.T_YLCP.CPMC;
                //规格
                string cpGg = ckmx.T_YLCP.CPGG ?? "";
                var    cpxh = ckmx.T_YLCP.CPXH ?? "";
                //单位
                string cpDw = ckmx.T_YLCP.CPDW ?? "";
                //数量
                double cpDj = ckmx.CPNUM ?? 0;
                //产品批号
                string scPh = ckmx.CPPH ?? "";
                //产品有效期
                string scRq = "";
                if (ckmx.CPYXQ != null)
                {
                    scRq = ckmx.CPYXQ.Value.ToString("yyyyMMdd");
                }
                var scrq = "";
                if (ckmx.CPSCRQ != null)
                {
                    scrq = ckmx.CPSCRQ.Value.ToString("yyyyMMdd");
                }
                //生产企业
                string cpScqy = "";
                if (ckmx.T_YLCP != null && ckmx.T_YLCP.T_SupQY1 != null && !string.IsNullOrEmpty(ckmx.T_YLCP.T_SupQY1.SupMC))
                {
                    cpScqy = ckmx.T_YLCP.T_SupQY1.SupMC;
                }
                //单价
                double cpPrice = Math.Round(ckmx.CPPRICE ?? 0.0, 2);
                //产品总价
                double rowTotal = Math.Round(cpDj * cpPrice, 2);

                total    = total + rowTotal;
                NumCpNum = NumCpNum + cpDj;
                //经营许可证号
                string xkzbh = "";
                if (ckmx.T_YLCP != null && ckmx.T_YLCP.T_SupQY1 != null && !string.IsNullOrEmpty(ckmx.T_YLCP.T_SupQY1.SupXKZBH))
                {
                    xkzbh = ckmx.T_YLCP.T_SupQY1.SupXKZBH;
                }
                //注册证号
                string cpzczh = ckmx.T_YLCP.CPZCZ;
                var    cytj   = ckmx.CYTJ;
                sHtml.Append("<tr align=\"center\"><td >" + cpName
                             + "</td><td style='vnd.ms-excel.numberformat:@' >" + cpGg + "</td><td style='vnd.ms-excel.numberformat:@' >" + cpxh + "</td><td >" + cpScqy
                             + "</td><td >" + cpDw + "</td><td style='vnd.ms-excel.numberformat:@'  >" + cpDj.ToString("") + "</td><td  style='vnd.ms-excel.numberformat:@' >" + scPh
                             + "</td><td style='vnd.ms-excel.numberformat:@'>" + scrq + "\r\n" + "--------" + "\r\n" + scRq + " </td>"
                             + "<td style='vnd.ms-excel.numberformat:@' >" + xkzbh
                             + "</td><td style='vnd.ms-excel.numberformat:@' >" + cpzczh
                             + "</td><td >" + cytj
                             + "</td><td style='border-right: thin solid black;' ></td></tr>");
            }
            //打印表尾
            sHtml.Append("<tr id='trtotal' height=\"40\" align=\"center\"><td colspan=\"7\" style='border-bottom: thin solid black;font-size:16px;'>合计金额:(大写)" + RmbHelper.CmycurD(total.ToString()) + "</td><td colspan=\"5\" style='border-bottom: thin solid black;border-right: thin solid black;font-size:16px;'>(小写)" + total.ToString("0.00") + "</td></tr>");
            var xsry = ckdinfo.T_XSD == null ? "" : ckdinfo.T_XSD.XSRY;

            sHtml.Append("<tr height=\"40\" align=\"center\"><td colspan=\"3\" align=\"left\" style='border:0px;'>销售员:&nbsp;" + xsry + "</td><td align=\"center\" colspan=\"3\" style='border:0px;'>复核员:&nbsp;" + ckdinfo.FHR + "</td ><td align =\"center\" colspan=\"3\" style='border:0px;'>出库员:&nbsp;" + ckdinfo.CKCHR + "</td ><td align =\"center\" colspan=\"3\" style='border:0px;'>收货人:&nbsp;</td></tr>");
            sHtml.Append("<tr><td colspan=\"12\" style='border:0px;'>公司地址:" + qy.WhsZCDZ + "</td></tr>");
            sHtml.Append("</table>");
            return(sHtml.ToString());
        }