/// <summary>
    /// 创建原因:获取当前已经存在的属性样品总条数
    /// 创建人:胡方扬
    /// 创建日期:2013-07-09
    /// </summary>
    /// <returns></returns>
    public int GetDustyCoutForBaseInfor()
    {
        int CountNum = 0;

        if (!String.IsNullOrEmpty(strBaseInfor_Id))
        {
            DataTable dt = new TMisMonitorDustattributePmLogic().SelectByTable(new TMisMonitorDustattributePmVo {
                BASEINFOR_ID = strBaseInfor_Id
            });
            CountNum = dt.Rows.Count;
        }

        return(CountNum);
    }
    /// <summary>
    /// 创建原因:根据原始记录表基本数据ID获取当前项目的属性表数据信息
    /// 创建人:胡方扬
    /// 创建日期:2013-07-09
    /// </summary>
    /// <returns></returns>
    public string getAttInfor()
    {
        string result = "";

        if (!String.IsNullOrEmpty(strBaseInfor_Id))
        {
            TMisMonitorDustattributePmVo objDustAtt = new TMisMonitorDustattributePmVo();
            objDustAtt.BASEINFOR_ID = strBaseInfor_Id;
            objDustAtt.SORT_FIELD   = "ID";
            objDustAtt.SORT_TYPE    = "";
            DataTable objDt    = new TMisMonitorDustattributePmLogic().SelectByTable(objDustAtt, intPageIndex, intPageSize);
            int       CountNum = new TMisMonitorDustattributePmLogic().GetSelectResultCount(objDustAtt);
            result = LigerGridDataToJson(objDt, CountNum);
        }
        return(result);
    }
    /// <summary>
    /// 创建原因:根据指定监测项目属性ID 更新指定列的数据
    /// 创建人:胡方扬
    /// 创建时间:2013-07-09
    /// </summary>
    /// <returns></returns>
    public bool UpdateAttValue()
    {
        bool blFlag = false;

        if (!String.IsNullOrEmpty(strAttInfor_Id) && !String.IsNullOrEmpty(strUpdateCell))
        {
            blFlag = new TMisMonitorDustattributePmLogic().UpdateCell(strAttInfor_Id, strUpdateCell, strUpdateCellValue);
            if (blFlag)
            {
                if (strUpdateCell == "SAMPLE_FWEIGHT" || strUpdateCell == "SAMPLE_EWEIGHT")
                {
                    //样品重量=初重-终重
                    Regex r = new Regex("^\\d+(\\.)?\\d*$");
                    TMisMonitorDustattributePmVo DustattributePmVo = new TMisMonitorDustattributePmVo();
                    DustattributePmVo = new TMisMonitorDustattributePmLogic().Details(strAttInfor_Id);
                    decimal dSAMPLE_FWEIGHT = r.IsMatch(DustattributePmVo.SAMPLE_FWEIGHT) ? decimal.Parse(DustattributePmVo.SAMPLE_FWEIGHT) : 0;
                    decimal dSAMPLE_EWEIGHT = r.IsMatch(DustattributePmVo.SAMPLE_EWEIGHT) ? decimal.Parse(DustattributePmVo.SAMPLE_EWEIGHT) : 0;
                    decimal dSAMPLE_WEIGHT  = Math.Abs(dSAMPLE_EWEIGHT - dSAMPLE_FWEIGHT);

                    blFlag = new TMisMonitorDustattributePmLogic().UpdateCell(strAttInfor_Id, "SAMPLE_WEIGHT", dSAMPLE_WEIGHT.ToString());
                    if (blFlag)
                    {
                        //样品浓度=样品重量/标况体积
                        decimal dL_STAND = r.IsMatch(DustattributePmVo.L_STAND) ? decimal.Parse(DustattributePmVo.L_STAND) : 0;
                        if (dL_STAND != 0)
                        {
                            blFlag = new TMisMonitorDustattributePmLogic().UpdateCell(strAttInfor_Id, "SAMPLE_CONCENT", Math.Round((dSAMPLE_WEIGHT / dL_STAND) * 1000000, 0).ToString());
                        }
                    }
                }
                if (strUpdateCell == "SAMPLE_WEIGHT")
                {
                    //样品浓度=样品重量/标况体积
                    Regex r = new Regex("^\\d+(\\.)?\\d*$");
                    TMisMonitorDustattributePmVo DustattributePmVo = new TMisMonitorDustattributePmVo();
                    DustattributePmVo = new TMisMonitorDustattributePmLogic().Details(strAttInfor_Id);
                    decimal dL_STAND       = r.IsMatch(DustattributePmVo.L_STAND) ? decimal.Parse(DustattributePmVo.L_STAND) : 0;
                    decimal dSAMPLE_WEIGHT = r.IsMatch(DustattributePmVo.SAMPLE_WEIGHT) ? decimal.Parse(DustattributePmVo.SAMPLE_WEIGHT) : 0;
                    if (dL_STAND != 0)
                    {
                        blFlag = new TMisMonitorDustattributePmLogic().UpdateCell(strAttInfor_Id, "SAMPLE_CONCENT", Math.Round((dSAMPLE_WEIGHT / dL_STAND) * 1000000, 0).ToString());
                    }
                }
            }
        }
        return(blFlag);
    }
Example #4
0
    /// <summary>
    /// 获取监测项目信息
    /// </summary>
    /// <returns></returns>
    private string getFourGridInfo(string strThreeGridId)
    {
        string strSortname  = Request.Params["sortname"];
        string strSortorder = Request.Params["sortorder"];
        //当前页面
        int intPageIndex = Convert.ToInt32(Request.Params["page"]);
        //每页记录数
        int intPageSize = Convert.ToInt32(Request.Params["pagesize"]);

        DataTable dt = new TMisMonitorResultLogic().getItemInfoInAlloction_QHD(strThreeGridId, "'01','00'", "0", "", "", intPageIndex, intPageSize);

        //退回意见
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            TMisMonitorResultVo     objResutlVo     = new TMisMonitorResultLogic().Details(dt.Rows[i]["ID"].ToString());
            TMisMonitorSampleInfoVo objSampleInfoVo = new TMisMonitorSampleInfoLogic().Details(objResutlVo.SAMPLE_ID);
            TMisMonitorSubtaskVo    objSubtaskVo    = new TMisMonitorSubtaskLogic().Details(objSampleInfoVo.SUBTASK_ID);

            TMisReturnInfoVo objReturnInfoVo = new TMisReturnInfoVo();
            objReturnInfoVo.TASK_ID        = objSubtaskVo.TASK_ID;
            objReturnInfoVo.SUBTASK_ID     = objSubtaskVo.ID;
            objReturnInfoVo.RESULT_ID      = dt.Rows[i]["ID"].ToString();
            objReturnInfoVo.CURRENT_STATUS = SerialType.Monitor_007;
            objReturnInfoVo.BACKTO_STATUS  = SerialType.Monitor_006;
            objReturnInfoVo        = new TMisReturnInfoLogic().Details(objReturnInfoVo);
            dt.Rows[i]["REMARK_1"] = objReturnInfoVo.SUGGESTION;

            //获取原始记录表的采样编号
            DataTable dtInfo        = new DataTable();
            DataRow[] drInfo        = dtInfo.Select("1=2");
            string    strFiter_Code = "";
            TMisMonitorDustinforVo objDustinforVo = new TMisMonitorDustinforVo();
            objDustinforVo.SUBTASK_ID = dt.Rows[i]["ID"].ToString();
            objDustinforVo            = new TMisMonitorDustinforLogic().Details(objDustinforVo);
            if (objDustinforVo.ID.Length > 0)
            {
                TMisMonitorDustattributeVo objDustattributeVo = new TMisMonitorDustattributeVo();
                objDustattributeVo.BASEINFOR_ID = objDustinforVo.ID;
                dtInfo = new TMisMonitorDustattributeLogic().SelectByTable(objDustattributeVo);
                if (dtInfo.Rows.Count > 0)
                {
                    drInfo = dtInfo.Select("FITER_CODE<>'平均'");
                }
                else
                {
                    TMisMonitorDustattributeSo2ornoxVo objDustattributeSo2ornoxVo = new TMisMonitorDustattributeSo2ornoxVo();
                    objDustattributeSo2ornoxVo.BASEINFOR_ID = objDustinforVo.ID;
                    dtInfo = new TMisMonitorDustattributeSo2ornoxLogic().SelectByTable(objDustattributeSo2ornoxVo);
                    if (dtInfo.Rows.Count > 0)
                    {
                        drInfo = dtInfo.Select("FITER_CODE<>'平均'");
                    }
                    else
                    {
                        TMisMonitorDustattributePmVo DustattributePmVo = new TMisMonitorDustattributePmVo();
                        DustattributePmVo.BASEINFOR_ID = objDustinforVo.ID;
                        dtInfo = new TMisMonitorDustattributePmLogic().SelectByTable(DustattributePmVo);
                        if (dtInfo.Rows.Count > 0)
                        {
                            drInfo = dtInfo.Select("FITER_CODE<>'平均'");
                        }
                    }
                }
                for (int j = 0; j < drInfo.Length; j++)
                {
                    strFiter_Code += drInfo[j]["FITER_CODE"].ToString() + ",";
                }
                dt.Rows[i]["REMARK_2"] = strFiter_Code.TrimEnd(',');
            }
        }

        int    intTotalCount = new TMisMonitorResultLogic().getItemInfoCountInAlloction_QHD(strThreeGridId, "'01','00'", "0", "", "");
        string strJson       = CreateToJson(dt, intTotalCount);

        return(strJson);
    }
Example #5
0
    public string CheckDustyTable(string strSumResultId)
    {
        bool      isSuccess   = true;
        DataTable dtDustinfor = new TMisMonitorDustinforLogic().SelectTableByID(strSumResultId);

        DataRow[] drDustinfor;

        //如果是烟尘,粉尘,总悬浮颗粒物,颗粒物(000001827,000001945,000000130,000000220)初重、终重、重量 不能为空
        drDustinfor = dtDustinfor.Select("ITEM_ID in('000001827','000001945','000000130','000000220')");
        for (int i = 0; i < drDustinfor.Length; i++)
        {
            TMisMonitorDustattributeVo objDustattribute = new TMisMonitorDustattributeVo();
            objDustattribute.BASEINFOR_ID = drDustinfor[i]["ID"].ToString();
            DataTable dt = new TMisMonitorDustattributeLogic().SelectByTable(objDustattribute);
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                if (dt.Rows[j]["FITER_BEGIN_WEIGHT"].ToString().Length == 0 && dt.Rows[j]["SAMPLE_CODE"].ToString() != "平均")
                {
                    isSuccess = false;
                    break;
                }
                if (dt.Rows[j]["FITER_AFTER_WEIGHT"].ToString().Length == 0 && dt.Rows[j]["SAMPLE_CODE"].ToString() != "平均")
                {
                    isSuccess = false;
                    break;
                }
                if (dt.Rows[j]["SAMPLE_WEIGHT"].ToString().Length == 0 && dt.Rows[j]["SAMPLE_CODE"].ToString() != "平均")
                {
                    isSuccess = false;
                    break;
                }
            }

            TMisMonitorDustattributePmVo objDustattributePm = new TMisMonitorDustattributePmVo();
            objDustattributePm.BASEINFOR_ID = drDustinfor[i]["ID"].ToString();
            dt = new TMisMonitorDustattributePmLogic().SelectByTable(objDustattributePm);
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                if (dt.Rows[j]["SAMPLE_FWEIGHT"].ToString().Length == 0 && dt.Rows[j]["FITER_CODE"].ToString() != "平均")
                {
                    isSuccess = false;
                    break;
                }
                if (dt.Rows[j]["SAMPLE_EWEIGHT"].ToString().Length == 0 && dt.Rows[j]["FITER_CODE"].ToString() != "平均")
                {
                    isSuccess = false;
                    break;
                }
                if (dt.Rows[j]["SAMPLE_WEIGHT"].ToString().Length == 0 && dt.Rows[j]["FITER_CODE"].ToString() != "平均")
                {
                    isSuccess = false;
                    break;
                }
            }
        }
        drDustinfor = dtDustinfor.Select("ITEM_ID not in('000001827','000001945','000000130','000000220')");
        for (int i = 0; i < drDustinfor.Length; i++)
        {
            TMisMonitorDustattributeVo objDustattribute = new TMisMonitorDustattributeVo();
            objDustattribute.BASEINFOR_ID = drDustinfor[i]["ID"].ToString();
            DataTable dt = new TMisMonitorDustattributeLogic().SelectByTable(objDustattribute);
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                if (dt.Rows[j]["SMOKE_POTENCY"].ToString().Length == 0 && dt.Rows[j]["SAMPLE_CODE"].ToString() != "平均")
                {
                    isSuccess = false;
                    break;
                }
            }

            TMisMonitorDustattributePmVo objDustattributePm = new TMisMonitorDustattributePmVo();
            objDustattributePm.BASEINFOR_ID = drDustinfor[i]["ID"].ToString();
            dt = new TMisMonitorDustattributePmLogic().SelectByTable(objDustattributePm);
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                if (dt.Rows[j]["SAMPLE_CONCENT"].ToString().Length == 0 && dt.Rows[j]["FITER_CODE"].ToString() != "平均")
                {
                    isSuccess = false;
                    break;
                }
            }
        }

        return(isSuccess == true ? "1" : "0");
    }
    /// <summary>
    /// 创建原因:计算原始记录表的平均数据
    /// 创建人:魏林
    /// 创建时间:2014-04-16
    /// </summary>
    /// <returns></returns>
    public string AvgAttInfor()
    {
        Regex   r              = new Regex("^\\d+(\\.)?\\d*$");
        bool    iSuccess       = true;
        decimal SAMPLE_CONCENT = 0;
        decimal FQPFL          = 0;
        int     iPRECISION     = 0;

        if (!String.IsNullOrEmpty(strBaseInfor_Id))
        {
            TMisMonitorDustattributePmVo objDustAtt = new TMisMonitorDustattributePmVo();
            objDustAtt.BASEINFOR_ID = strBaseInfor_Id;
            objDustAtt.SORT_FIELD   = "ID";
            DataTable dt = new TMisMonitorDustattributePmLogic().SelectByTable(objDustAtt);
            if (dt.Rows.Count > 0)
            {
                iPRECISION = dt.Rows[0]["SAMPLE_CONCENT"].ToString().Contains('.') ? dt.Rows[0]["SAMPLE_CONCENT"].ToString().Split('.')[1].Length : 0;
            }

            if (dt.Rows[dt.Rows.Count - 1]["FITER_CODE"].ToString() == "平均")
            {
                objDustAtt.SORT_FIELD = "";
                objDustAtt.ID         = dt.Rows[dt.Rows.Count - 1]["ID"].ToString();
                for (int i = 0; i < dt.Rows.Count - 1; i++)
                {
                    if (r.IsMatch(dt.Rows[i]["SAMPLE_CONCENT"].ToString()))
                    {
                        SAMPLE_CONCENT += decimal.Parse(dt.Rows[i]["SAMPLE_CONCENT"].ToString());
                    }
                    else
                    {
                        SAMPLE_CONCENT += GetNumber(dt.Rows[i]["SAMPLE_CONCENT"].ToString()) / 2;
                    }

                    FQPFL += r.IsMatch(dt.Rows[i]["FQPFL"].ToString()) ? decimal.Parse(dt.Rows[i]["FQPFL"].ToString()) : GetNumber(dt.Rows[i]["FQPFL"].ToString());
                }
                objDustAtt.SAMPLE_CONCENT = Math.Round(SAMPLE_CONCENT / (dt.Rows.Count - 1), iPRECISION).ToString();
                objDustAtt.FQPFL          = Math.Round(FQPFL / (dt.Rows.Count - 1), 0).ToString();

                iSuccess = new TMisMonitorDustattributePmLogic().Edit(objDustAtt);
            }
            else
            {
                objDustAtt.SORT_FIELD = "";
                objDustAtt.ID         = GetSerialNumber("t_mis_dutyAttPMInforID");
                objDustAtt.FITER_CODE = "平均";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (r.IsMatch(dt.Rows[i]["SAMPLE_CONCENT"].ToString()))
                    {
                        SAMPLE_CONCENT += decimal.Parse(dt.Rows[i]["SAMPLE_CONCENT"].ToString());
                    }
                    else
                    {
                        SAMPLE_CONCENT += GetNumber(dt.Rows[i]["SAMPLE_CONCENT"].ToString()) / 2;
                    }

                    FQPFL += r.IsMatch(dt.Rows[i]["FQPFL"].ToString()) ? decimal.Parse(dt.Rows[i]["FQPFL"].ToString()) : GetNumber(dt.Rows[i]["FQPFL"].ToString());
                }
                objDustAtt.SAMPLE_CONCENT = Math.Round(SAMPLE_CONCENT / dt.Rows.Count, iPRECISION).ToString();
                objDustAtt.FQPFL          = Math.Round(FQPFL / dt.Rows.Count, 0).ToString();

                iSuccess = new TMisMonitorDustattributePmLogic().Create(objDustAtt);
            }
            //更新结果表
            TMisMonitorDustinforVo objDustinforVo = new TMisMonitorDustinforLogic().Details(strBaseInfor_Id);
            TMisMonitorResultVo    objResultVo    = new TMisMonitorResultLogic().Details(objDustinforVo.SUBTASK_ID);
            objResultVo.ITEM_RESULT = objDustAtt.SAMPLE_CONCENT;
            iSuccess = new TMisMonitorResultLogic().Edit(objResultVo);
        }
        return(iSuccess ? "1" : "0");
    }