protected void BindList()
    {
        TBaseItemInfoVo objItem = new TBaseItemInfoVo();

        objItem.IS_DEL     = "0";
        objItem.MONITOR_ID = new TMisMonitorSubtaskLogic().Details(this.Request["SubtaskID"].ToString()).MONITOR_ID;
        List <TBaseItemInfoVo> lstItem = new TBaseItemInfoLogic().SelectByObject(objItem, 0, 0);

        lstItem.Sort(delegate(TBaseItemInfoVo a, TBaseItemInfoVo b) { return(a.ORDER_NUM.CompareTo(b.ORDER_NUM)); });

        this.ListBox1.DataSource     = lstItem;
        this.ListBox1.DataValueField = TBaseItemInfoVo.ID_FIELD;
        this.ListBox1.DataTextField  = TBaseItemInfoVo.ITEM_NAME_FIELD;
        this.ListBox1.DataBind();

        TMisMonitorTaskItemVo objPointItem = new TMisMonitorTaskItemVo();

        objPointItem.IS_DEL        = "0";
        objPointItem.TASK_POINT_ID = new TMisMonitorSampleInfoLogic().Details(this.Request["PointID"].ToString()).POINT_ID;
        List <TMisMonitorTaskItemVo> lstPointItem = new TMisMonitorTaskItemLogic().SelectByObject(objPointItem, 0, 0);

        string strPointItemIDs = "";

        for (int i = 0; i < lstPointItem.Count; i++)
        {
            strPointItemIDs += "," + lstPointItem[i].ITEM_ID;
        }
        strPointItemIDs = strPointItemIDs + ",";

        for (int i = lstItem.Count - 1; i >= 0; i--)
        {
            if (!strPointItemIDs.Contains(lstItem[i].ID))
            {
                lstItem.RemoveAt(i);
            }
        }

        this.ListBox2.DataSource     = lstItem;
        this.ListBox2.DataValueField = TBaseItemInfoVo.ID_FIELD;
        this.ListBox2.DataTextField  = TBaseItemInfoVo.ITEM_NAME_FIELD;
        this.ListBox2.DataBind();


        for (int i = 0; i < ListBox2.Items.Count; i++)
        {
            ListItem item = ListBox2.Items[i];
            ListBox1.Items.Remove(item);
        }
    }
    /// <summary>
    /// 判断项目是否超标
    /// </summary>
    /// <param name="strItemID">项目ID</param>
    /// <param name="strTaskPointID">监测任务点位ID</param>
    /// <returns>返回超标的项目名称</returns>
    protected bool IsOver(string strItemID, string strTaskPointID)
    {
        TMisMonitorTaskItemVo objTaskItem = new TMisMonitorTaskItemVo();

        objTaskItem.TASK_POINT_ID = strTaskPointID;
        objTaskItem.ITEM_ID       = strItemID;
        objTaskItem = new TMisMonitorTaskItemLogic().Details(objTaskItem);

        //样品信息
        TMisMonitorSampleInfoVo objSampleInfo = new TMisMonitorSampleInfoLogic().GetSampleInfoByPointID(strTaskPointID);
        // 样品结果信息
        TMisMonitorResultVo objResult = new TMisMonitorResultLogic().Details(new TMisMonitorResultVo()
        {
            ITEM_ID = strItemID, SAMPLE_ID = objSampleInfo.ID, QC_TYPE = "0"
        });
        //样品结果
        string strValue = objResult.ITEM_RESULT.Replace("l", "").Replace("L", "").Replace("nd", "").Replace("ND", "").Replace("(", "").Replace(")", "").Replace("(", "").Replace(")", "").Replace("/", "").Replace("-", "").Replace("—", "").Replace("。", ".").Replace("<", "").Replace(">", "");

        if (strValue.Length > 0 && IsNumeric(strValue))
        {
            float  ftResult    = float.Parse(strValue);                                           //结果值
            string strItemName = new TBaseItemInfoLogic().Details(objTaskItem.ITEM_ID).ITEM_NAME; //项目名称
            string strUpValue  = objTaskItem.ST_UPPER;                                            //项目上限
            string strLowValue = objTaskItem.ST_LOWER;                                            //项目下限
            if (strUpValue.IndexOf(",") >= 0)                                                     //噪声上限值
            {
                string   strItemValue = "";                                                       // 项目对应结果值
                string[] listUpValue  = strUpValue.Split(',');
                if (strItemName.IndexOf("昼间") >= 0)
                {
                    strItemValue = listUpValue[0].ToString();//昼间上限值
                }
                else if (strItemName.IndexOf("夜间") >= 0)
                {
                    strItemValue = listUpValue[1].ToString();//夜间上限值
                }
                else
                {
                    strItemValue = listUpValue[0].ToString();
                }
                if (strItemValue.Length > 0)
                {
                    if (strItemValue.IndexOf("<") >= 0)                                                 //上限
                    {
                        if (strItemValue.IndexOf("=") >= 0)                                             //小于等于
                        {
                            if (ftResult > float.Parse(strItemValue.Replace("<", "").Replace("=", ""))) //大于上限
                            {
                                return(true);
                            }
                        }
                        else
                        {
                            if (ftResult >= float.Parse(strItemValue.Replace("<", "").Replace("=", "")))//大于等于上限
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            if (strLowValue.IndexOf(",") > 0) //噪声下限值
            {
                string   strItemValue = "";   // 项目对应结果值
                string[] listLowValue = strLowValue.Split(',');
                if (strItemName.IndexOf("昼间") >= 0)
                {
                    strItemValue = listLowValue[0].ToString();
                }
                else if (strItemName.IndexOf("夜间") >= 0)
                {
                    strItemValue = listLowValue[1].ToString();
                }
                else
                {
                    strItemValue = listLowValue[0].ToString();
                }
                if (strItemValue.Length > 0)
                {
                    //下限
                    if (strItemValue.IndexOf(">") >= 0)
                    {
                        if (strItemValue.IndexOf("=") >= 0)                                             //小于等于
                        {
                            if (ftResult < float.Parse(strItemValue.Replace(">", "").Replace("=", ""))) //小于下限
                            {
                                return(true);
                            }
                        }
                        else
                        {
                            if (ftResult <= float.Parse(strItemValue.Replace(">", "").Replace("=", "")))//小于等于下限
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            else
            {
                //上限
                if (strUpValue.IndexOf("<") >= 0)
                {
                    if (strUpValue.IndexOf("=") >= 0)                                             //大于等于
                    {
                        if (ftResult > float.Parse(strUpValue.Replace("<", "").Replace("=", ""))) //大于上限
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        if (ftResult >= float.Parse(strUpValue.Replace("<", "").Replace("=", "")))//大于等于上限
                        {
                            return(true);
                        }
                    }
                }
                //下限
                if (strLowValue.IndexOf(">") >= 0)
                {
                    if (strLowValue.IndexOf("=") >= 0)
                    {
                        if (ftResult < float.Parse(strLowValue.Replace(">", "").Replace("=", "")))//小于下限
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        if (ftResult <= float.Parse(strLowValue.Replace(">", "").Replace("=", "")))//小于等于下限
                        {
                            return(true);
                        }
                    }
                }
            }
        }
        return(false);
    }
Exemple #3
0
    public static string CopyPointItem(string strCopyID, string strPastID, string strSubtaskID)
    {
        bool   isSuccess      = true;
        string strCopyPointID = new TMisMonitorSampleInfoLogic().Details(strCopyID).POINT_ID;
        string strPastPointID = new TMisMonitorSampleInfoLogic().Details(strPastID).POINT_ID;

        TMisMonitorTaskItemVo objPointItemCopy = new TMisMonitorTaskItemVo();

        objPointItemCopy.IS_DEL        = "0";
        objPointItemCopy.TASK_POINT_ID = strCopyPointID;
        DataTable dtCopy = new TMisMonitorTaskItemLogic().SelectByTable(objPointItemCopy);

        TMisMonitorTaskItemVo objPointItemPast = new TMisMonitorTaskItemVo();

        objPointItemPast.IS_DEL        = "0";
        objPointItemPast.TASK_POINT_ID = strPastPointID;
        DataTable dtPast = new TMisMonitorTaskItemLogic().SelectByTable(objPointItemPast);

        string strIsExistItem = "";

        for (int i = 0; i < dtPast.Rows.Count; i++)
        {
            strIsExistItem += "," + dtPast.Rows[i]["ITEM_ID"].ToString();
        }
        strIsExistItem += strIsExistItem.Length > 0 ? "," : "";

        //获取粘贴样品ID,填充结果表数据
        TMisMonitorSampleInfoVo objSample = new TMisMonitorSampleInfoLogic().Details(strPastID);

        for (int i = 0; i < dtCopy.Rows.Count; i++)
        {
            DataRow dr            = dtCopy.Rows[i];
            string  strCopyItemID = dr["ITEM_ID"].ToString();
            if (!strIsExistItem.Contains(strCopyItemID))
            {
                TMisMonitorTaskItemVo objPointItem = new TMisMonitorTaskItemVo();
                objPointItem.ID            = GetSerialNumber("t_base_company_point_item_id");
                objPointItem.IS_DEL        = "0";
                objPointItem.TASK_POINT_ID = strPastPointID;
                objPointItem.ITEM_ID       = strCopyItemID;

                isSuccess = new TMisMonitorTaskItemLogic().Create(objPointItem);

                TMisMonitorResultVo objResult = new TMisMonitorResultVo();
                objResult.ID            = GetSerialNumber("MonitorResultId");
                objResult.SAMPLE_ID     = objSample.ID;
                objResult.ITEM_ID       = strCopyItemID;
                objResult.QC_TYPE       = objSample.QC_TYPE;
                objResult.RESULT_STATUS = "01";

                //填充默认分析方法和方法依据
                TBaseItemAnalysisVo objItemAnalysis = new TBaseItemAnalysisVo();
                objItemAnalysis.ITEM_ID    = strCopyItemID;
                objItemAnalysis.IS_DEFAULT = "是";
                objItemAnalysis.IS_DEL     = "0";
                objItemAnalysis            = new TBaseItemAnalysisLogic().Details(objItemAnalysis);

                if (objItemAnalysis.ID.Length > 0)
                {
                    TBaseMethodAnalysisVo objMethod = new TBaseMethodAnalysisLogic().Details(objItemAnalysis.ANALYSIS_METHOD_ID);
                    objResult.ANALYSIS_METHOD_ID = objMethod.ID;
                    objMethod.METHOD_ID          = objMethod.METHOD_ID;
                }

                isSuccess = new TMisMonitorResultLogic().Create(objResult);

                string strAnalysisManagerID       = "";
                string strAnalysisManID           = "";
                TMisMonitorResultVo objResultTemp = new TMisMonitorResultVo();
                objResultTemp.ID = objResult.ID;
                DataTable dtManager = new TMisMonitorResultLogic().SelectManagerByTable(objResultTemp);
                if (dtManager.Rows.Count > 0)
                {
                    strAnalysisManagerID = dtManager.Rows[0]["ANALYSIS_MANAGER"].ToString();
                    strAnalysisManID     = dtManager.Rows[0]["ANALYSIS_ID"].ToString();
                }
                TMisMonitorResultAppVo objResultApp = new TMisMonitorResultAppVo();
                objResultApp.ID               = GetSerialNumber("MonitorResultAppId");
                objResultApp.RESULT_ID        = objResult.ID;
                objResultApp.HEAD_USERID      = strAnalysisManagerID;
                objResultApp.ASSISTANT_USERID = strAnalysisManID;

                isSuccess = new TMisMonitorResultAppLogic().Create(objResultApp);
            }
        }

        if (isSuccess)
        {
            return("1");
        }
        else
        {
            return("0");
        }
    }
Exemple #4
0
    public static string SaveDataItem(string strSubtaskID, string strSample, string strSelItem_IDs)
    {
        bool isSuccess = true;

        string[] arrSelItemId = strSelItem_IDs.Split(',');

        TMisMonitorSampleInfoVo objSample       = new TMisMonitorSampleInfoLogic().Details(strSample);
        TMisMonitorTaskItemVo   objPointItemSet = new TMisMonitorTaskItemVo();

        objPointItemSet.IS_DEL = "1";
        TMisMonitorTaskItemVo objPointItemWhere = new TMisMonitorTaskItemVo();

        objPointItemWhere.IS_DEL        = "0";
        objPointItemWhere.TASK_POINT_ID = objSample.POINT_ID;
        new TMisMonitorTaskItemLogic().Edit(objPointItemSet, objPointItemWhere);


        TMisMonitorResultVo objResult = new TMisMonitorResultVo();

        objResult = new TMisMonitorResultVo();
        if (strSample.Length > 0)
        {
            objResult.SAMPLE_ID = strSample;
            new TMisMonitorResultLogic().Delete(objResult);
        }


        if (strSelItem_IDs.Length > 0)
        {
            for (int i = 0; i < arrSelItemId.Length; i++)
            {
                TMisMonitorTaskItemVo objPointItem = new TMisMonitorTaskItemVo();
                objPointItem.ID            = GetSerialNumber("t_mis_monitor_task_item_id");
                objPointItem.IS_DEL        = "0";
                objPointItem.TASK_POINT_ID = objSample.POINT_ID;
                objPointItem.ITEM_ID       = arrSelItemId[i];

                isSuccess = new TMisMonitorTaskItemLogic().Create(objPointItem);

                objResult               = new TMisMonitorResultVo();
                objResult.ID            = GetSerialNumber("MonitorResultId");
                objResult.SAMPLE_ID     = objSample.ID;
                objResult.ITEM_ID       = arrSelItemId[i];
                objResult.QC_TYPE       = objSample.QC_TYPE;
                objResult.RESULT_STATUS = "01";

                //填充默认分析方法和方法依据
                TBaseItemAnalysisVo objItemAnalysis = new TBaseItemAnalysisVo();
                objItemAnalysis.ITEM_ID    = arrSelItemId[i];
                objItemAnalysis.IS_DEFAULT = "是";
                objItemAnalysis.IS_DEL     = "0";
                objItemAnalysis            = new TBaseItemAnalysisLogic().Details(objItemAnalysis);

                if (objItemAnalysis.ID.Length > 0)
                {
                    TBaseMethodAnalysisVo objMethod = new TBaseMethodAnalysisLogic().Details(objItemAnalysis.ANALYSIS_METHOD_ID);
                    objResult.ANALYSIS_METHOD_ID = objMethod.ID;
                    objMethod.METHOD_ID          = objMethod.METHOD_ID;
                }

                isSuccess = new TMisMonitorResultLogic().Create(objResult);

                string strAnalysisManagerID       = "";
                string strAnalysisManID           = "";
                TMisMonitorResultVo objResultTemp = new TMisMonitorResultVo();
                objResultTemp.ID = objResult.ID;
                DataTable dtManager = new TMisMonitorResultLogic().SelectManagerByTable(objResultTemp);
                if (dtManager.Rows.Count > 0)
                {
                    strAnalysisManagerID = dtManager.Rows[0]["ANALYSIS_MANAGER"].ToString();
                    strAnalysisManID     = dtManager.Rows[0]["ANALYSIS_ID"].ToString();
                }
                TMisMonitorResultAppVo objResultApp = new TMisMonitorResultAppVo();
                objResultApp.ID               = GetSerialNumber("MonitorResultAppId");
                objResultApp.RESULT_ID        = objResult.ID;
                objResultApp.HEAD_USERID      = strAnalysisManagerID;
                objResultApp.ASSISTANT_USERID = strAnalysisManID;

                isSuccess = new TMisMonitorResultAppLogic().Create(objResultApp);
            }
        }

        if (isSuccess)
        {
            return("1");
        }
        else
        {
            return("0");
        }
    }
Exemple #5
0
    /// <summary>
    /// 根据监测天数拆分任务(验收监测) Create By:weilin 2014-12-04
    /// </summary>
    /// <param name="strTaskID"></param>
    /// <returns></returns>
    private static bool SplitAcceptTask(string strTaskID, TBaseSerialruleVo objSerial)
    {
        bool bResult = true;
        TMisMonitorTaskVo   objTaskVo   = new TMisMonitorTaskLogic().Details(strTaskID);
        TMisMonitorReportVo objReportVo = new TMisMonitorReportVo();

        if (objTaskVo.CONTRACT_TYPE == "05")  //验收监测
        {
            TMisContractVo      objContractVo      = new TMisContractLogic().Details(objTaskVo.CONTRACT_ID);
            TMisContractPointVo objContractPointVo = new TMisContractPointVo();
            objContractPointVo.CONTRACT_ID = objTaskVo.CONTRACT_ID;
            objContractPointVo.IS_DEL      = "0";
            objContractPointVo             = new TMisContractPointLogic().Details(objContractPointVo);
            if (objContractPointVo.SAMPLE_DAY != "" && IsNumeric(objContractPointVo.SAMPLE_DAY) && objContractVo.REMARK5 == "")
            {
                int iSampleDay = int.Parse(objContractPointVo.SAMPLE_DAY);
                TMisMonitorTaskCompanyVo objClient = new TMisMonitorTaskCompanyLogic().Details(objTaskVo.CLIENT_COMPANY_ID);
                TMisMonitorTaskCompanyVo objTested = new TMisMonitorTaskCompanyLogic().Details(objTaskVo.TESTED_COMPANY_ID);
                for (int i = 1; i < iSampleDay; i++)
                {
                    TMisMonitorTaskVo objTaskAddVo = new TMisMonitorTaskVo();
                    objTaskAddVo.ID             = GetSerialNumber("t_mis_monitor_taskId");
                    objTaskAddVo.CONTRACT_ID    = objTaskVo.CONTRACT_ID;
                    objTaskAddVo.PLAN_ID        = objTaskVo.PLAN_ID;
                    objTaskAddVo.CONTRACT_CODE  = objTaskVo.CONTRACT_CODE;
                    objTaskAddVo.TICKET_NUM     = objTaskVo.TICKET_NUM + "-" + (i + 1).ToString();
                    objTaskAddVo.PROJECT_NAME   = objTaskVo.PROJECT_NAME;
                    objTaskAddVo.CONTRACT_YEAR  = objTaskVo.CONTRACT_YEAR;
                    objTaskAddVo.CONTRACT_TYPE  = objTaskVo.CONTRACT_TYPE;
                    objTaskAddVo.TEST_TYPE      = objTaskVo.TEST_TYPE;
                    objTaskAddVo.TEST_PURPOSE   = objTaskVo.TEST_PURPOSE;
                    objTaskAddVo.ASKING_DATE    = objTaskVo.ASKING_DATE;
                    objTaskAddVo.SAMPLE_SOURCE  = objTaskVo.SAMPLE_SOURCE;
                    objTaskAddVo.CREATOR_ID     = objTaskVo.CREATOR_ID;
                    objTaskAddVo.CREATE_DATE    = objTaskVo.CREATE_DATE;
                    objTaskAddVo.TASK_STATUS    = objTaskVo.TASK_STATUS;
                    objTaskAddVo.REMARK1        = objTaskVo.REMARK1;
                    objTaskAddVo.REMARK2        = objTaskVo.REMARK2;
                    objTaskAddVo.REMARK3        = objTaskVo.REMARK3;
                    objTaskAddVo.QC_STATUS      = objTaskVo.QC_STATUS;
                    objTaskAddVo.COMFIRM_STATUS = objTaskVo.COMFIRM_STATUS;
                    objTaskAddVo.ALLQC_STATUS   = objTaskVo.ALLQC_STATUS;
                    objTaskAddVo.REPORT_HANDLE  = objTaskVo.REPORT_HANDLE;

                    //构造监测任务委托企业信息
                    TMisMonitorTaskCompanyVo objClientAdd = new TMisMonitorTaskCompanyVo();
                    PageBase.CopyObject(objClient, objClientAdd);//复制对象
                    objClientAdd.ID      = PageBase.GetSerialNumber("t_mis_monitor_taskcompanyId");
                    objClientAdd.TASK_ID = objTaskAddVo.ID;
                    //构造监测任务受检企业信息
                    TMisMonitorTaskCompanyVo objTestedAdd = new TMisMonitorTaskCompanyVo();
                    PageBase.CopyObject(objTested, objTestedAdd);//复制对象
                    objTestedAdd.ID      = PageBase.GetSerialNumber("t_mis_monitor_taskcompanyId");
                    objTestedAdd.TASK_ID = objTaskAddVo.ID;

                    objTaskAddVo.CLIENT_COMPANY_ID = objClientAdd.ID;
                    objTaskAddVo.TESTED_COMPANY_ID = objTestedAdd.ID;

                    TMisMonitorReportVo objReportAdd = new TMisMonitorReportVo();
                    objReportVo.ID          = GetSerialNumber("t_mis_monitor_report_id");
                    objReportVo.REPORT_CODE = objReportVo.REPORT_CODE + "-" + (i + 1).ToString();
                    objReportVo.TASK_ID     = objTaskAddVo.ID;
                    objReportVo.IF_GET      = "0";

                    //监测子任务信息 根据委托书监测类别进行构造
                    ArrayList arrSubTask         = new ArrayList(); //监测子任务集合
                    ArrayList arrSubTaskApp      = new ArrayList();
                    ArrayList arrTaskPoint       = new ArrayList(); //监测点位集合
                    ArrayList arrPointItem       = new ArrayList(); //监测点位明细集合
                    ArrayList arrSample          = new ArrayList(); //样品集合
                    ArrayList arrSampleResult    = new ArrayList(); //样品结果集合
                    ArrayList arrSampleResultApp = new ArrayList(); //样品分析执行表

                    List <TMisMonitorSubtaskVo> listSubTask = new TMisMonitorSubtaskLogic().SelectByObject(new TMisMonitorSubtaskVo()
                    {
                        TASK_ID = objTaskVo.ID
                    }, 0, 0);
                    for (int j = 0; j < listSubTask.Count; j++)
                    {
                        TMisMonitorSubtaskVo objSubTaskAdd = new TMisMonitorSubtaskVo();
                        CopyObject(listSubTask[j], objSubTaskAdd);
                        objSubTaskAdd.ID      = GetSerialNumber("t_mis_monitor_subtaskId");
                        objSubTaskAdd.TASK_ID = objTaskAddVo.ID;
                        arrSubTask.Add(objSubTaskAdd);

                        TMisMonitorSubtaskAppVo objSubTaskApp = new TMisMonitorSubtaskAppVo();
                        objSubTaskApp.SUBTASK_ID = listSubTask[j].ID;
                        objSubTaskApp            = new TMisMonitorSubtaskAppLogic().Details(objSubTaskApp);
                        TMisMonitorSubtaskAppVo objSubTaskAppAdd = new TMisMonitorSubtaskAppVo();
                        CopyObject(objSubTaskApp, objSubTaskAppAdd);
                        objSubTaskAppAdd.ID         = GetSerialNumber("TMisMonitorSubtaskAppID");
                        objSubTaskAppAdd.SUBTASK_ID = objSubTaskAdd.ID;
                        arrSubTaskApp.Add(objSubTaskAppAdd);

                        List <TMisMonitorTaskPointVo> listTaskPoint = new TMisMonitorTaskPointLogic().SelectByObject(new TMisMonitorTaskPointVo()
                        {
                            TASK_ID = objTaskVo.ID, SUBTASK_ID = listSubTask[j].ID, IS_DEL = "0"
                        }, 0, 0);
                        for (int k = 0; k < listTaskPoint.Count; k++)
                        {
                            TMisMonitorTaskPointVo objTaskPointAdd = new TMisMonitorTaskPointVo();
                            CopyObject(listTaskPoint[k], objTaskPointAdd);
                            objTaskPointAdd.ID      = GetSerialNumber("t_mis_monitor_taskpointId");
                            objTaskPointAdd.TASK_ID = objTaskAddVo.ID;
                            arrTaskPoint.Add(objTaskPointAdd);

                            TMisMonitorSampleInfoVo objSampleInfoVo = new TMisMonitorSampleInfoVo();
                            objSampleInfoVo.SUBTASK_ID = listSubTask[j].ID;
                            objSampleInfoVo.POINT_ID   = listTaskPoint[k].ID;
                            objSampleInfoVo            = new TMisMonitorSampleInfoLogic().Details(objSampleInfoVo);
                            TMisMonitorSampleInfoVo objSampleInfoAdd = new TMisMonitorSampleInfoVo();
                            CopyObject(objSampleInfoVo, objSampleInfoAdd);
                            objSampleInfoAdd.ID          = GetSerialNumber("MonitorSampleId");
                            objSampleInfoAdd.SUBTASK_ID  = objSubTaskAdd.ID;
                            objSampleInfoAdd.POINT_ID    = objTaskPointAdd.ID;
                            objSampleInfoAdd.SAMPLE_CODE = CreateBaseDefineCodeForSample(objSerial, objTaskAddVo, objSubTaskAdd);
                            arrSample.Add(objSampleInfoAdd);

                            List <TMisMonitorTaskItemVo> listTaskItem = new TMisMonitorTaskItemLogic().SelectByObject(new TMisMonitorTaskItemVo()
                            {
                                TASK_POINT_ID = listTaskPoint[k].ID, IS_DEL = "0"
                            }, 0, 0);
                            for (int l = 0; l < listTaskItem.Count; l++)
                            {
                                TMisMonitorTaskItemVo objTaskItemAdd = new TMisMonitorTaskItemVo();
                                CopyObject(listTaskItem[l], objTaskItemAdd);
                                objTaskItemAdd.ID            = GetSerialNumber("t_mis_monitor_task_item_id");
                                objTaskItemAdd.TASK_POINT_ID = objTaskPointAdd.ID;
                                arrPointItem.Add(objTaskItemAdd);
                            }

                            List <TMisMonitorResultVo> listResult = new TMisMonitorResultLogic().SelectByObject(new TMisMonitorResultVo()
                            {
                                SAMPLE_ID = objSampleInfoVo.ID
                            }, 0, 0);
                            for (int l = 0; l < listResult.Count; l++)
                            {
                                TMisMonitorResultVo objResultAdd = new TMisMonitorResultVo();
                                CopyObject(listResult[l], objResultAdd);
                                objResultAdd.ID        = GetSerialNumber("MonitorResultId");
                                objResultAdd.SAMPLE_ID = objSampleInfoAdd.ID;
                                arrSampleResult.Add(objResultAdd);

                                TMisMonitorResultAppVo objResultAppVo = new TMisMonitorResultAppVo();
                                objResultAppVo.RESULT_ID = listResult[l].ID;
                                objResultAppVo           = new TMisMonitorResultAppLogic().Details(objResultAppVo);
                                TMisMonitorResultAppVo objResultAppAdd = new TMisMonitorResultAppVo();
                                CopyObject(objResultAppVo, objResultAppAdd);
                                objResultAppAdd.ID        = GetSerialNumber("MonitorResultAppId");
                                objResultAppAdd.RESULT_ID = objResultAdd.ID;
                                arrSampleResultApp.Add(objResultAppAdd);
                            }
                        }
                    }
                    if (new TMisMonitorTaskLogic().SaveTrans(objTaskAddVo, objClientAdd, objTestedAdd, objReportVo, arrTaskPoint, arrSubTask, arrSubTaskApp, arrPointItem, arrSample, arrSampleResult, arrSampleResultApp))
                    {
                        bResult = true;
                    }
                }
                //更新任务单号
                objTaskVo.TICKET_NUM = objTaskVo.TICKET_NUM + "-1";
                new TMisMonitorTaskLogic().Edit(objTaskVo);
                //更新报告单号
                objReportVo.REPORT_CODE = objReportVo.REPORT_CODE + "-1";
                new TMisMonitorReportLogic().Edit(objReportVo);
                //更新验收委托书任务已经拆分任务的标志
                objContractVo.REMARK5 = "1";
                new TMisContractLogic().Edit(objContractVo);
            }
        }

        return(bResult);
    }
Exemple #6
0
    public static string GetLims(string strValue)
    {
        bool isSuccess = true;

        string strConnection = ConfigurationManager.ConnectionStrings["Lims"].ToString();

        DataTable dt = new TMisMonitorResultLogic().getSimpleCodeInResult_QY(strValue, new PageBase().LogInfo.UserInfo.ID, "20");

        foreach (DataRow dr in dt.Rows)
        {
            if (dr["ITEM_RESULT"].ToString().Length == 0)
            {
                string strResultId      = dr["ID"].ToString();
                string strSampleCode    = dr["SAMPLE_CODE"].ToString();
                string strApparatusCode = dr["APPARATUS_CODE"].ToString();
                string strItemId        = dr["ITEM_ID"].ToString();
                string strUnitSrc       = "mg/L"; //暂时写死单位为mg/L
                string strItemName      = "";     //获取项目在仪器中对应的化学式,暂时写死
                if ("000000052|000000147|000000690|000000896|000000897|000001261|000001358|000001374|000001471|000001487|000001584|000001600|000001697|000001713|000001810".Contains(strItemId))
                {
                    strItemName = "As4";
                }
                if ("000000056|000000151|000000694|000000890|000000891|000001265|000001356|000001378|000001469|000001491|000001582|000001604|000001695|000001717|000001808".Contains(strItemId))
                {
                    strItemName = "Cd";
                }
                if ("000000059|000000142|000000158|000000697|000000884|000000886|000000887|000000888|000001268|000001354|000001381|000001467|000001494|000001580|000001607|000001693|000001720|000001806".Contains(strItemId))
                {
                    strItemName = "Hg4";
                }
                if ("000000073|000000711|000001282|000001395|000001508|000001621|000001734".Contains(strItemId))
                {
                    strItemName = "TN";
                }

                TMisMonitorTaskItemLogic objLogic = new TMisMonitorTaskItemLogic();
                string strSql = "select * from T_LIMS_APPARATUS_DATA where APPARATUS_CODE='{0}'";
                strSql = string.Format(strSql, strApparatusCode);
                DataTable dtTable = objLogic.SelectSQL_ByTable_forMobile(strSql, 0, 0);

                string strRe = "", strUnit = "", strSrcID = "", strTableName = "";
                #region get Lims Data
                if (dtTable.Rows.Count > 0)
                {
                    DataRow drTable = dtTable.Rows[0];
                    strTableName = drTable["LIMS_TABLE"].ToString();
                    string strRltColName    = drTable["LIMS_RESULT_COL"].ToString();
                    string strUnitColName   = drTable["LIMS_UNIT_COL"].ToString();
                    string strSampleColName = drTable["LIMS_SAMPLE_COL"].ToString();
                    string strItemColName   = drTable["LIMS_ITEM_COL"].ToString();

                    DataTable objTable   = new DataTable();
                    string    strLimsSql = "select * from " + strTableName + " where IF_ERR='0' and " + strSampleColName + " ='" + strSampleCode + "' and " + strItemColName + " = '" + strItemName + "'";
                    objTable = ExecuteDataTableEx(strLimsSql, strConnection);

                    if (objTable.Rows.Count > 0)
                    {
                        DataRow drResult = objTable.Rows[0];
                        strRe    = drResult[strRltColName].ToString();
                        strUnit  = drResult[strUnitColName].ToString();
                        strSrcID = drResult["ID"].ToString();
                    }
                }
                #endregion
                if (strRe.Length > 0)
                {
                    TMisMonitorResultVo objResult = new TMisMonitorResultVo();
                    objResult.ID       = strResultId;
                    objResult.REMARK_4 = strSrcID;
                    objResult.REMARK_5 = strTableName;
                    objResult.REMARK_3 = "1";
                    if (strUnit == "ug/L" || strUnit == "μg/L")
                    {
                        if (strUnitSrc == "mg/L")
                        {
                            float fRe = float.Parse(strRe) / 1000;
                            objResult.ITEM_RESULT = fRe.ToString();
                        }
                    }
                    else
                    {
                        objResult.ITEM_RESULT = strRe;
                    }
                    new TMisMonitorResultLogic().Edit(objResult);
                }
            }
        }

        return(isSuccess == true ? "1" : "0");
    }
    protected void BindList()
    {
        TBaseItemInfoVo objItem = new TBaseItemInfoVo();

        objItem.IS_DEL = "0";
        string monitor_type = new TMisMonitorSubtaskLogic().Details(this.Request["SubtaskID"].ToString()).MONITOR_ID;

        //黄进军 添加 20150417
        //如果是环境质量监测类型项目,我们需要把他们变为废水或废气项目,因为系统中只设置了废水、废气、噪声等项目类型
        TBaseMonitorTypeInfoVo tmtype = new TBaseMonitorTypeInfoVo();

        tmtype = new TBaseMonitorTypeInfoLogic().Details(monitor_type);
        if (tmtype.REMARK1 != null || tmtype.REMARK1 != "")
        {
            objItem.MONITOR_ID = tmtype.REMARK1;
        }
        else
        {
            objItem.MONITOR_ID = monitor_type;
        }
        List <TBaseItemInfoVo> lstItem = new TBaseItemInfoLogic().SelectByObject(objItem, 0, 0);

        lstItem.Sort(delegate(TBaseItemInfoVo a, TBaseItemInfoVo b) { return(a.ORDER_NUM.CompareTo(b.ORDER_NUM)); });

        this.ListBox1.DataSource     = lstItem;
        this.ListBox1.DataValueField = TBaseItemInfoVo.ID_FIELD;
        this.ListBox1.DataTextField  = TBaseItemInfoVo.ITEM_NAME_FIELD;
        this.ListBox1.DataBind();

        TMisMonitorTaskItemVo objPointItem = new TMisMonitorTaskItemVo();

        objPointItem.IS_DEL        = "0";
        objPointItem.TASK_POINT_ID = new TMisMonitorSampleInfoLogic().Details(this.Request["PointID"].ToString()).POINT_ID;
        List <TMisMonitorTaskItemVo> lstPointItem = new TMisMonitorTaskItemLogic().SelectByObject(objPointItem, 0, 0);

        string strPointItemIDs = "";

        for (int i = 0; i < lstPointItem.Count; i++)
        {
            strPointItemIDs += "," + lstPointItem[i].ITEM_ID;
        }
        strPointItemIDs = strPointItemIDs + ",";

        for (int i = lstItem.Count - 1; i >= 0; i--)
        {
            if (!strPointItemIDs.Contains(lstItem[i].ID))
            {
                lstItem.RemoveAt(i);
            }
        }

        this.ListBox2.DataSource     = lstItem;
        this.ListBox2.DataValueField = TBaseItemInfoVo.ID_FIELD;
        this.ListBox2.DataTextField  = TBaseItemInfoVo.ITEM_NAME_FIELD;
        this.ListBox2.DataBind();


        for (int i = 0; i < ListBox2.Items.Count; i++)
        {
            ListItem item = ListBox2.Items[i];
            ListBox1.Items.Remove(item);
        }
    }