Exemplo n.º 1
0
    private System.Data.DataTable GetMsData()
    {
        TCheckResultBC BC = new TCheckResultBC();
        string         startTime;
        string         endTime;

        System.DateTime currentTime = new System.DateTime();
        if (this.tbxDate_key.Text == "")
        {
            currentTime = System.DateTime.Now;
            startTime   = currentTime.AddDays(-7).ToString("yyyy/MM/dd");
            endTime     = currentTime.ToString("yyyy/MM/dd");
        }
        else
        {
            startTime = Convert.ToDateTime(this.tbxDate_key.Text).ToString("yyyy/MM/dd");
            endTime   = startTime;
        }

        return(BC.SelTCheckResult(this.tbxLineId_key.Text, startTime, endTime, "", ""));
    }
Exemplo n.º 2
0
    /// <summary>
    /// 新规检查
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        //string chk_no = this.hidChkNo.Text;
        //string make_no = this.hidMakeNo.Text;
        //string code = this.hidCode.Text;
        //string suu = this.hidSuu.Text;



        string make_no = this.tbxMakeNo_key.Text;
        string code    = this.tbxCode_key.Text;
        string suu     = this.hidSuu.Text;
        string line_id = this.tbxLineId_key.Text;

        Context.Items["chk_date"]  = this.tbxDate_key.Text.Trim();
        Context.Items["make_no"]   = make_no;
        Context.Items["code"]      = code;
        Context.Items["line_id"]   = line_id;
        Context.Items["user"]      = this.tbxCheckUser.Text.Trim();
        Context.Items["user_name"] = this.lblUserName.Text;


        TCheckResultBC BC = new TCheckResultBC();

        System.Data.DataTable dt = BC.SelTCheckResult(this.tbxLineId_key.Text, "", "", make_no, code);



        Int32 i, mxChkTimes, chkTimes, idx;

        mxChkTimes = 0;
        idx        = 0;

        string yotei_chk_date;

        DataRow[] drs;

        string tmp_chk_no;

        ///sp = chr("_");

        if (dt.Rows.Count > 0)
        {
            yotei_chk_date = dt.Rows[0]["yotei_chk_date"].ToString();
            drs            = dt.Select("yotei_chk_date='" + yotei_chk_date + "'");
            for (i = 0; i <= drs.Length - 1; i++)
            {
                chkTimes = Convert.ToInt32(dt.Rows[i]["chk_times"].ToString());
                if (mxChkTimes < chkTimes)
                {
                    mxChkTimes = chkTimes;
                    idx        = i;
                }
            }

            if (drs[idx]["temp_id"].ToString().Trim() == "")
            {
                Common.ShowMsg(this.Page, "检查模板不存在");
                return;
            }

            string[] sArray = drs[idx]["chk_no"].ToString().Split('_');

            tmp_chk_no = sArray[0] + "_" + sArray[1] + "_" + (mxChkTimes + 1).ToString();

            BC.InsTCheckResult(tmp_chk_no
                               , System.DateTime.Now.Year.ToString()
                               , (mxChkTimes + 1).ToString()
                               , drs[idx]["plan_no"].ToString()
                               , drs[idx]["line_id"].ToString()
                               , drs[idx]["make_no"].ToString()
                               , drs[idx]["code"].ToString()
                               , drs[idx]["suu"].ToString()
                               , drs[idx]["temp_id"].ToString()
                               , drs[idx]["chk_result"].ToString()
                               , this.tbxCheckUser.Text.Trim()
                               , drs[idx]["yotei_chk_date"].ToString()
                               , System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
                               , ""
                               , ""
                               , "0"
                               , this.tbxCheckUser.Text.Trim()
                               , System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
                               );

            Context.Items["chk_no"] = tmp_chk_no;
            Server.Transfer("t_check_ms.aspx");
        }
        else
        {
            Common.ShowMsg(this.Page, "检查计划数据不存在;");
            return;
        }
    }