Exemplo n.º 1
0
        /// <summary>
        /// 显示详情页
        /// </summary>
        /// <param name="EditType">编辑类型</param>
        /// <returns>返回编辑结果</returns>
        public ActionResult TestReportEdit(E_tb_TestReport eTestReport, string EditType, int?InfoID)
        {
            //ViewData["RecordList"] = tOriginalRecord.GetList("").Tables[0];
            ViewData["_abclist"]       = PageTools.GetSelectList(tTypeDict.GetList("SubjectID=5").Tables[0], "TypeID", "TypeName", false);
            ViewData["RecordSelect"]   = new DataTable();
            ViewData["ReportDataList"] = new DataTable();
            ViewBag._userName          = CurrentUserInfo.UserName;
            if (EditType == "Edit")
            {
                eTestReport = tTestReport.GetModel(Convert.ToInt32(InfoID));
                //ViewData["RecordList"] = tOriginalRecord.GetList("RecordID not in (" + eTestReport.RecordIDS + ")").Tables[0];
                //ViewData["RecordSelect"] = tOriginalRecord.GetList("RecordID in (" + eTestReport.RecordIDS + ")").Tables[0];
                ViewData["ReportDataList"] = tTestReportData.GetList("ReportID=" + eTestReport.ReportID).Tables[0]; //检验数据

                E_tb_InPersonnel eInPersonnel = null;
                if (eTestReport.ApprovalPersonnelID != null && eTestReport.ApprovalPersonnelID > 0)
                {
                    eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.ApprovalPersonnelID));
                    eTestReport.ApprovalPersonnelName = (eInPersonnel != null ? eInPersonnel.PersonnelName : "");
                }
                if (eTestReport.examinePersonnelID != null && eTestReport.examinePersonnelID > 0)
                {
                    eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.examinePersonnelID));
                    eTestReport.examinePersonnelName = (eInPersonnel != null ? eInPersonnel.PersonnelName : "");
                }
                if (eTestReport.MainTestPersonnelID != null && eTestReport.MainTestPersonnelID > 0)
                {
                    eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.MainTestPersonnelID));
                    eTestReport.MainTestPersonnelName = (eInPersonnel != null ? eInPersonnel.PersonnelName : "");
                }
                if (string.IsNullOrEmpty(eTestReport.Explain))
                {
                    eTestReport.Explain = @"
一、	本检验报告复印、涂改无效;封面未加盖检验专用章和无检验专用骑缝章(如2页以上)的检验报告无效。<br/>
二、	检验报告仅对送检、抽检样品负责。<br/>
三、	本检验报告及检验单位名称不得用于产品的标签、广告评优及商品宣传等。<br/>
四、	本检验报告一式二份,一份由检验单位存档,一份交送检、抽检单位。<br/>
五、	本检验报告由出具报告单位负责,并进行解释说明。<br/>
六、	检验单位保存该检验报告6年。<br/><br/>"    ;
                    if (eTestReport.MainTestPersonnelID > 0)
                    {
                        try
                        {
                            eInPersonnel = tInPersonnel.GetModel(eTestReport.MainTestPersonnelID.Value);
                            var _areaid = (eInPersonnel != null ? eInPersonnel.AreaID : 0);
                            if (_areaid > 0)
                            {
                                switch (_areaid)
                                {
                                case 2:
                                {
                                    eTestReport.Explain += @"食品检测中心<br/>
检验单位地址:天津市塘沽区东沽石油新村配餐采购加工中心院内<br/>
邮政编码:300452<br/>
联系电话:022-66917343<br/>
传真:022-66917343<br/><br/>";
                                    break;
                                }

                                case 3:
                                {
                                    eTestReport.Explain += @"食品检测中心(葫芦岛)<br/>
检验单位地址:辽宁省葫芦岛市龙港区北港码头配餐公司葫芦岛配送基地<br/>
邮政编码:125000<br/>
联系电话:0429-2080522<br/>
传真:0429-2082522<br/><br/>";
                                    break;
                                }

                                case 4:
                                {
                                    eTestReport.Explain += @"食品检测中心(深圳)<br/>
检验单位地址:广东省惠州市大亚湾区石化大道中滨海十二路9号惠州物流基地W18<br/>
邮政编码:516082<br/>
联系电话:0752-5952819<br/>
传真:0752-5952818<br/><br/>";
                                    break;
                                }

                                case 5:
                                {
                                    eTestReport.Explain += @"食品检测中心(湛江)<br/>
检验单位地址:广东省湛江市坡头区南油一区配餐服务公司湛江分公司<br/>
邮政编码:524057<br/>
联系电话:0759-3910316<br/>
传真:0759-3901145<br/><br/>";
                                    break;
                                }

                                case 6:
                                {
                                    eTestReport.Explain += @"食品检测中心(龙口)<br/>
检验单位地址::山东省烟台市龙口市环海中路中海油物流码头配餐公司龙口配送基地<br/>
邮政编码:265700<br/>
联系电话:0535-8838131<br/>
传真:0535-8838131<br/><br/>";
                                    break;
                                }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }


            ViewBag.SampleName = eTestReport.SampleName;
            if (eTestReport.SampleName.ToString().IndexOf(')') > -1)
            {
                ViewBag.SampleName = eTestReport.SampleName.ToString().Substring(0, eTestReport.SampleName.ToString().IndexOf(')') + 1);
            }
            else
            {
                ViewBag.SampleName = Regex.Replace(ViewBag.SampleName, @"[^\u4e00-\u9fa5|(|)]", "");
            }
            ViewBag.AreaName = tArea.GetModel(int.Parse(eTestReport.AreaID.ToString())).TestReportName;
            var sampleModel = new BLL.tb_SampleBLL().GetModelList(" sampleNum = '" + eTestReport.SampleNum + "'").FirstOrDefault();

            ViewBag._cydw = "none";
            ViewBag._sydw = "none";
            if (sampleModel.isDetection)
            {
                eTestReport.ToSampleMode = "抽样";
                ViewBag._cydw            = "";
            }
            else
            {
                eTestReport.ToSampleMode = "送样";
                ViewBag._sydw            = "";
            }
            ViewBag.Department = eTestReport.Department;
            var    _orlist        = new BLL.OriginalRecord.T_tb_OriginalRecord().GetModelList(" RecordID in (" + eTestReport.RecordIDS + ")");
            String _projectIds    = "";
            int    _tempProjectId = 0;

            for (int i = 0; i < _orlist.Count; i++)
            {
                if (_tempProjectId == _orlist[i].ProjectID)
                {
                    continue;
                }
                if (String.IsNullOrEmpty(_projectIds))
                {
                    _projectIds = _orlist[i].ProjectID.ToString();
                }
                else
                {
                    _projectIds += "," + _orlist[i].ProjectID.ToString();
                }
            }
            eTestReport.TestBasis = "";
            var _projectlist = new BLL.Laboratory.T_tb_Project().GetModelList(" ProjectID in (" + _projectIds + ")");

            foreach (var item in _projectlist)
            {
                if (String.IsNullOrEmpty(eTestReport.TestBasis))
                {
                    eTestReport.TestBasis = item.ExpeMethod;
                }
                else
                {
                    eTestReport.TestBasis += "," + item.ExpeMethod;
                }
            }
            //ViewBag.Department = "";
            //if (sampleModel != null)
            //{
            //    if (sampleModel.isDetection)
            //    {
            //        ViewBag.Department = sampleModel.detectionCompany;
            //    }
            //    else
            //    {
            //        var clint = new BLL.ClientManage.T_tb_ClientManage().GetModel(Convert.ToInt32(sampleModel.InspectCompany));
            //        ViewBag.Department = clint.ClientName;
            //    }
            //}


            ViewBag._TestType = "";
            if (eTestReport.TestType != null)
            {
                ViewBag._TestType = tTypeDict.GetModel(int.Parse(eTestReport.TestType.ToString())).TypeName;
            }
            //ViewBag.TestTime = eTestReport.TestTime == null ? "" : Convert.ToDateTime(eTestReport.TestTime).ToString("yyyy/MM/dd");
            ViewBag.TestTime            = eTestReport.IssuedTime == null ? "" : Convert.ToDateTime(eTestReport.IssuedTime).ToString("yyyy/MM/dd");
            ViewBag.DetectPersonnelID   = CurrentUserInfo.PersonnelID;
            ViewBag.DetectPersonnelName = CurrentUserInfo.PersonnelName;

            if (string.IsNullOrEmpty(eTestReport.Remarks))
            {
                eTestReport.Remarks = "无";
            }

            eTestReport.EditType = EditType;
            return(View(eTestReport));
        }
Exemplo n.º 2
0
        T_tb_Area tArea = new T_tb_Area();                              //区域/单位

        public ActionResult TestReportView(E_tb_TestReport eTestReport)
        {
            ViewData["ReportDataList"] = tTestReportData.GetList("ReportID=" + eTestReport.ReportID).Tables[0]; //检验数据
            eTestReport = tTestReport.GetModel(eTestReport.ReportID);
            E_tb_TypeDict eTypeDict = tTypeDict.GetModel(Convert.ToInt32(eTestReport.TestType));

            eTestReport.TestTypeName = (eTypeDict != null ? eTypeDict.TypeName : "");
            E_tb_InPersonnel eInPersonnel = new E_tb_InPersonnel();

            if (eTestReport.ApprovalPersonnelID != null && eTestReport.ApprovalPersonnelID > 0)
            {
                eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.ApprovalPersonnelID));
                if (eInPersonnel != null)
                {
                    eTestReport.ApprovalPersonnelName = eInPersonnel.PersonnelName;
                }
            }

            if (eTestReport.examinePersonnelID != null && eTestReport.examinePersonnelID > 0)
            {
                eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.examinePersonnelID));
                if (eInPersonnel != null)
                {
                    eTestReport.examinePersonnelName = eInPersonnel.PersonnelName;
                }
            }

            if (eTestReport.MainTestPersonnelID != null && eTestReport.MainTestPersonnelID > 0)
            {
                eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.MainTestPersonnelID));
                if (eInPersonnel != null)
                {
                    eTestReport.MainTestPersonnelName = eInPersonnel.PersonnelName;
                }
            }

            //eTestReport.SampleName = Regex.Replace(eTestReport.SampleName, @"[^\u4e00-\u9fa5]", "");
            if (eTestReport.SampleName.ToString().IndexOf(')') > -1)
            {
                eTestReport.SampleName = eTestReport.SampleName.ToString().Substring(0, eTestReport.SampleName.ToString().IndexOf(')') + 1);
            }
            else if (eTestReport.SampleName.ToString().IndexOf(')') > -1)
            {
                eTestReport.SampleName = eTestReport.SampleName.ToString().Substring(0, eTestReport.SampleName.ToString().IndexOf(')') + 1);
            }
            else
            {
                eTestReport.SampleName = Regex.Replace(eTestReport.SampleName, @"[^\u4e00-\u9fa5|(|)]", "");
            }

            var sampleModel = new BLL.tb_SampleBLL().GetModelList(" sampleNum = '" + eTestReport.SampleNum + "'").FirstOrDefault();

            ViewBag._cydw  = "none";
            ViewBag._sydw  = "none";
            ViewBag._scjdw = "";
            if (sampleModel != null)
            {
                if (sampleModel.isDetection)
                {
                    eTestReport.ToSampleMode = "抽样";
                    ViewBag._cydw            = "";
                    ViewBag._scjdw           = eTestReport.SamplingCompany;
                    eTestReport.Department   = "/";
                }
                else
                {
                    eTestReport.ToSampleMode    = "送样";
                    ViewBag._sydw               = "";
                    eTestReport.SamplingCompany = "/";
                    ViewBag._scjdw              = eTestReport.Department;
                }
            }
            if (String.IsNullOrEmpty(eTestReport.Specifications))
            {
                eTestReport.Specifications = "/";
            }
            if (String.IsNullOrEmpty(eTestReport.Packing))
            {
                eTestReport.Packing = "/";
            }
            if (String.IsNullOrEmpty(eTestReport.productNum))
            {
                eTestReport.productNum = "/";
            }



            ViewBag._IssuedTime = "";
            if (eTestReport.IssuedTime != null)
            {
                ViewBag._IssuedTime = eTestReport.IssuedTime.Value.ToString("yyyy/MM/dd");
            }
            var    _orlist        = new BLL.OriginalRecord.T_tb_OriginalRecord().GetModelList(" RecordID in (" + eTestReport.RecordIDS + ")");
            String _projectIds    = "";
            int    _tempProjectId = 0;

            for (int i = 0; i < _orlist.Count; i++)
            {
                if (_tempProjectId == _orlist[i].ProjectID)
                {
                    continue;
                }
                if (String.IsNullOrEmpty(_projectIds))
                {
                    _projectIds = _orlist[i].ProjectID.ToString();
                }
                else
                {
                    _projectIds += "," + _orlist[i].ProjectID.ToString();
                }
            }
            eTestReport.TestBasis = "";
            var _projectlist = new BLL.Laboratory.T_tb_Project().GetModelList(" ProjectID in (" + _projectIds + ")");

            foreach (var item in _projectlist)
            {
                if (String.IsNullOrEmpty(eTestReport.TestBasis))
                {
                    eTestReport.TestBasis = item.ExpeMethod;
                }
                else
                {
                    eTestReport.TestBasis += "," + item.ExpeMethod;
                }
            }
            ViewBag.AreaName = tArea.GetModel(int.Parse(eTestReport.AreaID.ToString())).TestReportName;
            return(View(eTestReport));
        }