//删除功能建议在使用时隐藏
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string strID = "";

            foreach (RepeaterItem LabelID in Repeater1.Items)
            {
                CheckBox chk = (CheckBox)LabelID.FindControl("CheckBox1");
                if (chk.Checked)
                {
                    string    check = ((Label)LabelID.FindControl("LabelID")).Text;
                    string    sql   = "SELECT * FROM TBMA_TYPEINFO WHERE TY_NAME IN ( SELECT DISTINCT TY_NAME FROM TBMA_TYPEINFO WHERE TY_FATHERID='" + check + "' )";
                    DataTable table = new DataTable();
                    table = DBCallCommon.GetDTUsingSqlText(sql);
                    if (table.Rows.Count != 0)
                    {
                        message.Text = "编号为" + check + "的大类存在子类!删除操作无法进行。";
                        return;
                    }
                    strID += "'" + ((Label)LabelID.FindControl("LabelID")).Text + "'" + ",";
                }
            }
            if (strID.Length > 1)
            {
                strID = strID.Substring(0, strID.Length - 1);
                sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("DELETE FROM TBMA_TYPEINFO WHERE TY_ID IN (" + strID + ")", sqlConn);
                sqlConn.Open();
                SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
                dr.Close();
                GetData();
            }
        }
 /// <summary>
 /// 执行存储过程验证序号(保存时)
 /// </summary>
 /// <param name="psv"></param>
 private void ExecSpareParts(ParamsBj pbj)
 {
     try
     {
         SqlConnection sqlConn = new SqlConnection();
         SqlCommand    sqlCmd  = new SqlCommand();
         sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
         DBCallCommon.PrepareStoredProc(sqlConn, sqlCmd, "[PRO_TM_SparePartsGen]");
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@TableName", pbj.TableName, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@EngID", pbj.EngID, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@BjType", pbj.BjType, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@CalType", pbj.CalType, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@BjFather", pbj.BjFather, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@UserID", pbj.UserID, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Xishu", pbj.Xishu, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@WaitFor", pbj.WaitFor, SqlDbType.Text, 3000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@BiaoShi", pbj.BiaoShi, SqlDbType.Text, 3000);
         sqlConn.Open();
         sqlCmd.ExecuteNonQuery();
         sqlConn.Close();
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #3
0
        /*
         * 反核销
         */
        protected void FVerification_Click(object sender, EventArgs e)
        {
            string        code = Request.QueryString["IDC"].ToString();
            string        sql  = DBCallCommon.GetStringValue("connectionStrings");
            SqlConnection con  = new SqlConnection(sql);

            con.Open();
            SqlCommand cmd = new SqlCommand("AntiVerification", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@RedCode", SqlDbType.VarChar, 50);                                                //增加参数入库单号@RedCode
            cmd.Parameters["@RedCode"].Value = code;                                                              //为参数初始化
            cmd.Parameters.Add("@Information", SqlDbType.VarChar, 50).Direction = ParameterDirection.ReturnValue; //增加输出参数@Information
            cmd.ExecuteNonQuery();
            con.Close();
            if (cmd.Parameters["@Information"].Value.ToString() == "0")
            {
                LabelResult.Text = "反核销成功!";
            }
            if (cmd.Parameters["@Information"].Value.ToString() == "1")
            {
                LabelResult.ForeColor = Color.Red;
                LabelResult.Text      = "所选红字入库单与原入库单不匹配无法核销,请检查!";
            }

            FVerification.Enabled = false; //反核销不可见

            Back.Visible = false;

            Close.Visible = true;//关闭显示
        }
Beispiel #4
0
        protected void GetChildPage(string strID, string strIDPath, int nDepth)
        {
            string sqlText = "Select * from power_page Where fatherID='" + strID + "'";

            //SqlDataReader dr = dba.getDRExSQL(sqlText) ;
            SqlConnection sqlConn = new SqlConnection();
            SqlCommand    sqlCmd  = new SqlCommand();

            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            sqlCmd.Connection        = sqlConn;
            sqlCmd.CommandText       = sqlText;
            SqlDataReader dr = DBCallCommon.GetDataReader(sqlConn, sqlCmd);

            //dr.IsClosed
            if (dr.Read())
            {
                do
                {
                    DDLCategory.Items.Add(new ListItem(GetLeft("--", nDepth) + dr["Name"].ToString(), strIDPath + dr["page_id"].ToString() + ","));
                    GetChildPage(dr["page_id"].ToString(), strIDPath + "," + dr["page_id"].ToString() + ",", nDepth + 1);
                } while (dr.Read());

                dr.Close();
            }
            else
            {
                dr.Close();
                return;
            }
        }
Beispiel #5
0
        protected void btn_antihs_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConn = new SqlConnection();

            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            DBCallCommon.openConn(sqlConn);
            SqlCommand sqlCmd = new SqlCommand("GouJiRuKuHeSuanAnti", sqlConn);

            sqlCmd.CommandType    = CommandType.StoredProcedure;
            sqlCmd.CommandTimeout = 0;
            sqlCmd.Parameters.Add("@gmonth", SqlDbType.VarChar, 2);
            sqlCmd.Parameters["@gmonth"].Value = getMonth();

            sqlCmd.Parameters.Add("@gyear", SqlDbType.VarChar, 4);
            sqlCmd.Parameters["@gyear"].Value = getYear();

            sqlCmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue;                      //增加返回值参数@retVal

            sqlCmd.ExecuteNonQuery();

            DBCallCommon.closeConn(sqlConn);

            if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 0)
            {
                string script = @"alert('反入库核算成功!');location.href ='FM_RuKu_Adjust_Accounts.aspx'";

                ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true);
            }
            else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 1)
            {
                string script = @"alert('反入库核算失败!');'";

                ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true);
            }
        }
Beispiel #6
0
        protected void deletebt_Click(object sender, EventArgs e)
        {
            string strId = "";

            foreach (RepeaterItem e_id in equipmentRepeater.Items)
            {
                CheckBox chk = (CheckBox)e_id.FindControl("checkboxstaff");
                if (chk.Checked)
                {
                    strId += "'" + ((Label)e_id.FindControl("Id")).Text + "'" + ",";
                }
            }
            if (strId.Length > 1)
            {
                strId = strId.Substring(0, strId.Length - 1);
                sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("delete from ESM_EQU  where  Id in (" + strId + ")", sqlConn);
                DBCallCommon.openConn(sqlConn);
                SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
                dr.Close();
            }
            DBCallCommon.closeConn(sqlConn);
            UCPaging1.CurrentPage = 1;
            ReGetBoundData();
        }
        protected void Button_save_Click(object sender, EventArgs e)
        {
            string        sqltext = "";
            string        state   = "";
            SqlCommand    sqlCmd  = new SqlCommand();
            SqlConnection sqlConn = new SqlConnection();

            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            sqlConn.Open();
            sqlCmd.Connection = sqlConn;
            foreach (RepeaterItem Reitem in tbpc_purshaseplanrealityRepeater.Items)
            {
                state = ((Label)Reitem.FindControl("PUR_STATE")).Text;
                if (state == "3")
                {
                    sqltext = "update TBPC_PURCHASEPLAN set PUR_CGMAN=@PUR_CGMANCODE  " +
                              "where PUR_PTCODE=@PUR_PTCODE and PUR_CSTATE='0'";
                    sqlCmd.CommandText = sqltext;
                    sqlCmd.Parameters.Clear();
                    sqlCmd.Parameters.AddWithValue("@PUR_PTCODE", ((TextBox)Reitem.FindControl("PUR_PTCODE")).Text);
                    sqlCmd.Parameters.AddWithValue("@PUR_CGMANCODE", ((Label)Reitem.FindControl("PUR_CGMANCODE")).Text);
                    int rowsnum = sqlCmd.ExecuteNonQuery();
                }
            }
            DBCallCommon.closeConn(sqlConn);
            repeaterdatabind();
            ddl_caigouyuan.SelectedIndex = 0;
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('保存成功!');", true);
        }
        //删除记录,建议在使用时隐藏改功能
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            System.Data.SqlClient.SqlConnection sqlConn = new SqlConnection();
            string strID = "";

            foreach (RepeaterItem labID in Repeater1.Items)
            {
                CheckBox chk = (CheckBox)labID.FindControl("CheckBox1");
                if (chk.Checked)
                {
                    strID += "'" + ((Label)labID.FindControl("labID")).Text + "',";
                }
            }
            if (strID.Length > 1)
            {
                strID = strID.Substring(0, strID.Length - 1);
                sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");

                System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("DELETE FROM TBMA_MATERIAL WHERE ID IN (" + strID + ")", sqlConn);
                sqlConn.Open();
                SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
                dr.Close();
            }
            GetData();
        }
Beispiel #9
0
 /// <summary>
 /// 执行存储过程
 /// </summary>
 /// <param name="psv"></param>
 private System.Data.DataTable ExecMarCheck(ParamsCheckMarNotBelongToMar psv)
 {
     System.Data.DataTable dt;
     try
     {
         SqlConnection sqlConn = new SqlConnection();
         SqlCommand    sqlCmd  = new SqlCommand();
         sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
         DBCallCommon.PrepareStoredProc(sqlConn, sqlCmd, "PRO_TM_CheckMarNotBelongToMarBOM");
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@StrTable", psv.StrTabeleName, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@ENG_ID", psv.TaskID, SqlDbType.Text, 1000);
         sqlConn.Open();
         dt = DBCallCommon.GetDataTableUsingCmd(sqlCmd);
         sqlConn.Close();
     }
     catch (Exception)
     {
         throw;
     }
     return(dt);
     //SqlParameter[] pms = new SqlParameter[] {
     //new SqlParameter("@StrTable",psv.StrTabeleName),
     //new SqlParameter("@ENG_ID",psv.TaskID)
     //}
     //return SqlHelper.ExecuteDataTable("PRO_TM_CheckMarNotBelongToMarBOM", CommandType.StoredProcedure, pms);
 }
 /// <summary>
 /// 执行存储过程验证序号(保存时)
 /// </summary>
 /// <param name="psv"></param>
 private void ExecImport(ParamsImport psv)
 {
     try
     {
         SqlConnection sqlConn = new SqlConnection();
         SqlCommand    sqlCmd  = new SqlCommand();
         sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
         DBCallCommon.PrepareStoredProc(sqlConn, sqlCmd, "[PRO_TM_ImportDataAll_Modify]");
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Tg_TableName", psv.Tg_TableName, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Tg_Engid", psv.Tg_Engid, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Tg_FatherIndex", psv.Tg_FatherIndex, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Tg_TotalTaishu", psv.Tg_TotalTaishu, SqlDbType.Int, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Src_TableName", psv.Src_TableName, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Src_Engid", psv.Src_Engid, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Src_FatherIndex", psv.Src_FatherIndex, SqlDbType.Text, 1000);
         //////DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Sc_TotalTaishu", psv.Sc_TotalTaishu, SqlDbType.Int, 1000);
         //  DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Coype_Type", psv.Coype_Type, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Bef_RepTuhao_1", psv.Bef_RepTuhao_1, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Aft_RepTuhao_1", psv.Aft_RepTuhao_1, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Bef_RepTuhao_2", psv.Bef_RepTuhao_2, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Aft_RepTuhao_2", psv.Aft_RepTuhao_2, SqlDbType.Text, 1000);
         DBCallCommon.AddParameterToStoredProc(sqlCmd, "@NotImport", psv.NotImport, SqlDbType.Text, 4000);
         sqlConn.Open();
         sqlCmd.CommandTimeout = 0;
         sqlCmd.ExecuteNonQuery();
         sqlConn.Close();
     }
     catch (Exception)
     {
         throw;
     }
 }
        /// <summary>
        /// 执行存储过生成材料计划
        /// </summary>
        /// <param name="psv"></param>
        protected DataTable ExecMpCreate(ParamsMpCreate pmc)
        {
            DataTable dt;

            try
            {
                SqlConnection sqlConn = new SqlConnection();
                SqlCommand    sqlCmd  = new SqlCommand();
                sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                DBCallCommon.PrepareStoredProc(sqlConn, sqlCmd, "[PRO_TM_OutCreate]");
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Engid", pmc.Engid, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Engtype", pmc.Engtype, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@MpChange", pmc.MpChange, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Mpno", pmc.Mpno, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@MpType", pmc.MpType, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Pjid", pmc.Pjid, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@StrWhere", pmc.StrWhere, SqlDbType.Text, 3000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@TableName", pmc.TableName, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@OrgTable", pmc.OrgTable, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Userid", pmc.Userid, SqlDbType.Text, 1000);
                sqlConn.Open();
                sqlCmd.CommandTimeout = 1000;
                ////sqlCmd.ExecuteNonQuery();
                dt = DBCallCommon.GetDataTableUsingCmd(sqlCmd);
                sqlConn.Close();
            }
            catch (Exception)
            {
                throw;
            }
            return(dt);
        }
Beispiel #12
0
        protected void deletebt_Click(object sender, EventArgs e)
        {
            string sqltext;

            sqltext = "select * from EQU_tzsb order by Id";
            setpagerparm("EQU_tzsb", "Id", "Id*1 as Id,Code,Name,Type,Specification,Ocode,Rcode,Ucode,Manufa,Position,Ustate,Redate,Remark", "", "Name LIKE'%" + name.Text.ToString().Trim() + "%'", 0, 10);
            DataTable dt    = DBCallCommon.GetDTUsingSqlText(sqltext);
            string    strId = "";

            foreach (RepeaterItem e_id in tzsbRepeater.Items)
            {
                CheckBox chk = (CheckBox)e_id.FindControl("checkboxstaff");
                if (chk.Checked)
                {
                    strId += "'" + ((Label)e_id.FindControl("Id")).Text + "'" + ",";
                }
            }
            if (strId.Length > 1)
            {
                strId = strId.Substring(0, strId.Length - 1);
                sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("delete from EQU_tzsb where  Id in (" + strId + ")", sqlConn);
                DBCallCommon.openConn(sqlConn);
                SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
                dr.Close();
            }
            DBCallCommon.closeConn(sqlConn);
            databind();
        }
Beispiel #13
0
        private string ExecMsCreate(MSCreate mscreate)
        {
            DataTable dt;

            try
            {
                SqlConnection sqlConn = new SqlConnection();
                SqlCommand    sqlCmd  = new SqlCommand();
                sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                DBCallCommon.PrepareStoredProc(sqlConn, sqlCmd, "[PRO_TM_MS_NorCreate]");
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@StrTabeleName", mscreate.StrTabeleName, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@ViewTabelName", mscreate.ViewTabelName, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@TaskID", mscreate.TaskID, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@MS_PID", mscreate.MS_PID, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@MsTableName", mscreate.MsTableName, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@MsRewTabelName", mscreate.MsRewTabelName, SqlDbType.Text, 1000);
                DBCallCommon.AddParameterToStoredProc(sqlCmd, "@SubmitID", mscreate.SubmitID, SqlDbType.Text, 1000);

                sqlConn.Open();
                dt = DBCallCommon.GetDataTableUsingCmd(sqlCmd);
                sqlConn.Close();
            }
            catch (Exception)
            {
                return("1");
            }
            return(dt.Rows[0][0].ToString());
        }
Beispiel #14
0
        public static string PurRejectJudge(string pur_pcode)
        {
            string retValue = "0";

            if (pur_pcode.Contains("/BOM_"))
            {
                System.Data.DataTable dt;
                try
                {
                    SqlConnection sqlConn = new SqlConnection();
                    SqlCommand    sqlCmd  = new SqlCommand();
                    sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                    DBCallCommon.PrepareStoredProc(sqlConn, sqlCmd, "[PRO_PurPlanRejectJudge]");
                    DBCallCommon.AddParameterToStoredProc(sqlCmd, "@PT_CODE", pur_pcode, SqlDbType.Text, 1000);
                    sqlConn.Open();
                    dt = DBCallCommon.GetDataTableUsingCmd(sqlCmd);
                    sqlConn.Close();
                }
                catch (Exception)
                {
                    throw;
                }
                retValue = dt.Rows[0][0].ToString();
            }
            return(retValue);
        }
        protected void deletebt_Click(object sender, EventArgs e)
        {
            string strId = "";

            DDlpartment.SelectedValue = "00";
            DDlgroup.SelectedValue    = "00";
            foreach (RepeaterItem e_id in tbds_staffinfoRepeater.Items)
            {
                CheckBox chk = (CheckBox)e_id.FindControl("checkboxstaff");
                if (chk.Checked)
                {
                    strId += "'" + ((Label)e_id.FindControl("ST_CODE")).Text + "'" + ",";
                }
            }
            if (strId.Length > 1)
            {
                strId = strId.Substring(0, strId.Length - 1);
                sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("update TBDS_STAFFINFO set ST_PD=1 where  ST_ID in (" + strId + ")", sqlConn);
                DBCallCommon.openConn(sqlConn);
                SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
                dr.Close();
            }
            DBCallCommon.closeConn(sqlConn);
            databind();
        }
Beispiel #16
0
 protected void Btn_update_OnClick(object sender, EventArgs e)
 {
     try
     {
         string sql = DBCallCommon.GetStringValue("connectionStrings");
         sql += "Asynchronous Processing=true;";
         SqlConnection sqlConn = new SqlConnection(sql);
         sqlConn.Open();
         SqlCommand sqlCmd = new SqlCommand("YS_COST_ORDER_PROCEDURE", sqlConn);
         sqlCmd.CommandType    = CommandType.StoredProcedure;
         sqlCmd.CommandTimeout = 0;
         sqlCmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue;                  //增加返回值参数@retVal
         IAsyncResult result = sqlCmd.BeginExecuteNonQuery();
         sqlCmd.EndExecuteNonQuery(result);
         sqlConn.Close();
         if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 0)
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('更新成功!!!');", true);
             UCPaging1.CurrentPage = 1;
             InitVar();
             GetTechRequireData();
             lab_updatetime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #17
0
        protected void deletebt_Click(object sender, EventArgs e)
        {
            Dfinddept1.SelectedValue     = "00";
            Dfinddept2.SelectedValue     = "00";
            Radiogrouportw.Visible       = false; //隐藏
            Radiogrouportw.SelectedValue = "1";   //默认为岗位/班组
            DataTable     dt      = null;
            SqlConnection sqlConn = new SqlConnection();

            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            DBCallCommon.openConn(sqlConn);
            SqlCommand sqlCmd = new SqlCommand();//选择用

            sqlCmd.Connection = sqlConn;
            SqlCommand sqlCmd1 = new SqlCommand();//删除用

            sqlCmd1.Connection = sqlConn;
            string cannotstr;

            foreach (RepeaterItem e_id in tbds_depinfoRepeater.Items)
            {
                CheckBox chk = (CheckBox)e_id.FindControl("checkboxdep");
                if (chk.Checked)
                {
                    cannotstr = ((Label)e_id.FindControl("DEP_CODE")).Text;
                    #region
                    //查找对象
                    if (Radiogrouportw.SelectedValue == "0")
                    {
                        sqlCmd.CommandText  = "select * from TBDS_STAFFINFO where ST_JOBCAT LIKE '" + cannotstr + "%'";
                        sqlCmd1.CommandText = "delete from TBDS_JOBCATINFO where JC_ID LIKE '" + cannotstr + "%'";
                    }
                    else
                    {
                        sqlCmd.CommandText  = "select * from TBDS_STAFFINFO where ST_DEPID LIKE '" + cannotstr + "%'";
                        sqlCmd1.CommandText = "delete from TBDS_DEPINFO where DEP_CODE LIKE '" + cannotstr + "%'";
                    }
                    #endregion
                    dt = DBCallCommon.GetDataTableUsingCmd(sqlCmd);
                    if (dt.Rows.Count > 0)
                    {
                        Lnumber.Text = Convert.ToString(dt.Rows.Count);
                        Response.Write("<script>alert('编码为" + cannotstr + "下有人员,不能删除,若想删除,请删除该编码下的所有人员!');</script>");
                    }
                    else
                    {
                        sqlCmd1.ExecuteNonQuery();//执行删除操作
                    }
                }
            }
            UCPaging1.CurrentPage = 1;
            databind();
            DBCallCommon.closeConn(sqlConn);
        }
        private void insertinitialdata()
        {
            string        sqltext = "";
            string        submpid = Tb_mpid.Text.Substring(Tb_mpid.Text.IndexOf(".") + 1, 6);
            SqlConnection sqlConn = new SqlConnection();
            SqlCommand    sqlCmd  = new SqlCommand();

            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            sqlConn.Open();
            sqlCmd.Connection = sqlConn;
            foreach (RepeaterItem Reitem in Purchaseplan_startcontentRepeater.Items)
            {
                sqltext = "INSERT INTO TBPC_PURCHASEPLAN(PUR_PCODE,PUR_PJID,PUR_PJNAME,PUR_ENGID,PUR_ENGNAME,PUR_PTCODE,PUR_MARID,PUR_MARNAME,PUR_MARNORM,PUR_MARTERIAL,PUR_GUOBIAO,PUR_FIXEDSIZE,PUR_NUM,PUR_NUNIT,PUR_USTNUM,PUR_RPNUM,PUR_PUNIT,PUR_STDATE,PUR_PRONODE,PUR_STATE) " +
                          "VALUES(@PUR_PCODE,@PUR_PJID,@PUR_PJNAME,@PUR_ENGID,@PUR_ENGNAME,@PUR_PTCODE,@PUR_MARID,@PUR_MARNAME,@PUR_MARNORM,@PUR_MARTERIAL,@PUR_GUOBIAO,@PUR_FIXEDSIZE,@PUR_NUM,@PUR_NUNIT,@PUR_USTNUM,@PUR_RPNUM,@PUR_PUNIT,@PUR_STDATE,@PUR_PRONODE,@PUR_STATE)";
                sqlCmd.CommandText = sqltext;
                sqlCmd.Parameters.Clear();
                sqlCmd.Parameters.AddWithValue("@PUR_PCODE", Tb_mpid.Text.ToString());
                sqlCmd.Parameters.AddWithValue("@PUR_PJID", tb_pjid.Text.ToString());
                sqlCmd.Parameters.AddWithValue("@PUR_PJNAME", tb_pj.Text);
                sqlCmd.Parameters.AddWithValue("@PUR_ENGID", tb_engid.Text);
                sqlCmd.Parameters.AddWithValue("@PUR_ENGNAME", tb_engid.Text);
                sqlCmd.Parameters.AddWithValue("@PUR_PTCODE", ((Label)Reitem.FindControl("PUR_PTCODE")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_MARID", ((Label)Reitem.FindControl("PUR_MARID")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_MARNAME", ((Label)Reitem.FindControl("PUR_MARNAME")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_MARNORM", ((Label)Reitem.FindControl("PUR_MARNORM")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_MARTERIAL", ((Label)Reitem.FindControl("PUR_MARTERIAL")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_GUOBIAO", ((Label)Reitem.FindControl("PUR_GUOBIAO")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_FIXEDSIZE", ((Label)Reitem.FindControl("PUR_FIXEDSIZE")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_NUM", ((Label)Reitem.FindControl("PUR_NEDDNUM")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_NUNIT", ((Label)Reitem.FindControl("PUR_NUNIT")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_USTNUM", '0');
                sqlCmd.Parameters.AddWithValue("@PUR_RPNUM", ((Label)Reitem.FindControl("PUR_NEDDNUM")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_PUNIT", ((Label)Reitem.FindControl("PUR_NUNIT")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_STDATE", Tb_shijian.Text);
                sqlCmd.Parameters.AddWithValue("@PUR_PRONODE", '0');
                sqlCmd.Parameters.AddWithValue("@PUR_STATE", '0');
                int rowsnum = sqlCmd.ExecuteNonQuery();
            }
            sqltext = "INSERT INTO TBPC_PCHSPLANRVW(PR_SHEETNO,PR_DEPID,PR_DEPNAME,PR_SQREID,PR_SQRENAME,PR_FZREID,PR_FZRENAME,PR_REVIEWA,PR_REVIEWANM,PR_REVIEWATIME,PR_STATE,PR_PRONODE) " +
                      "VALUES('" + Tb_mpid.Text.ToString() + "' ,'" + tb_depid.Text + "','" + tb_dep.Text + "','" + Tb_shenqingrenid.Text + "','" + Tb_shenqingren.Text
                      + "','" + Tb_fuzirenid.Text + "','" + Tb_fuziren.Text + "','" + TextBoxexecutorid.Text.ToString() + "','" + TextBoxexecutor.Text.ToString() + "','" + Tb_shijian.Text + "','000','0')";
            DBCallCommon.ExeSqlText(sqltext);
            if (submpid == "JSB MS")
            {
                sqltext = "UPDATE TBPM_OUTSOURCETOTAL SET OST_STATE='9' WHERE OST_STATE='8' AND OST_OUTSOURCENO='" + Tb_mpid.Text.ToString() + "'";
            }
            else
            {
                sqltext = "UPDATE TBPM_MPFORALLRVW SET MP_STATE='9' WHERE MP_STATE='8' AND MP_ID='" + Tb_mpid.Text.ToString() + "'";
            }
            DBCallCommon.ExeSqlText(sqltext);
            DBCallCommon.closeConn(sqlConn);
            Response.Redirect("~/PC_Data/PC_TBPC_Purchaseplan_check_list.aspx");
        }
        /*****************************反核算***************************/
        protected void btn_Antihs_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConn = new SqlConnection();

            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            DBCallCommon.openConn(sqlConn);
            SqlCommand sqlCmd = new SqlCommand("AntiAccounting", sqlConn);

            sqlCmd.CommandType = CommandType.StoredProcedure;

            sqlCmd.Parameters.Add("@gmonth", SqlDbType.VarChar, 2);
            sqlCmd.Parameters["@gmonth"].Value = getMonth();

            sqlCmd.Parameters.Add("@gyear", SqlDbType.VarChar, 4);
            sqlCmd.Parameters["@gyear"].Value = getYear();

            sqlCmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue;                      //增加返回值参数@retVal

            sqlCmd.ExecuteNonQuery();

            DBCallCommon.closeConn(sqlConn);

            if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 0)
            {
                //反核算成功
                string script = @"alert('反核算成功!');";

                ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true);

                btn_hs.Enabled = true;

                btn_antihs.Enabled = false;

                bindGrid();
            }
            else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 1)
            {
                //关账失败!
                string script = @"alert('系统未核算,不能反核算!');";

                //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "error", script, true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true);
            }
            else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 2)
            {
                //关账失败!
                string script = @"alert('系统反核算失败!');";

                //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "error", script, true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true);
            }
        }
        //反审当前当前出库单,调用出库单反审存储过程,反审前先判断是否满足反审条件。
        protected void AntiVerify_Click(object sender, EventArgs e)
        {
            if (LabelState.Text != "2")
            {
                string script = @"alert('当前出库单未审核无法反审!');";

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "error", script, true);
                return;
            }
            string        sql = DBCallCommon.GetStringValue("connectionStrings");
            SqlConnection con = new SqlConnection(sql);

            con.Open();
            SqlCommand cmd = new SqlCommand("AntiVerifyOut", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@OutCode", SqlDbType.VarChar, 50);                                      //增加参数入库单号@InCode
            cmd.Parameters["@OutCode"].Value = LabelCode.Text;                                          //为参数初始化
            cmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue; //增加返回值参数@retVal
            cmd.ExecuteNonQuery();
            con.Close();
            if (Convert.ToInt32(cmd.Parameters["@retVal"].Value) == 0)
            {
                Response.Redirect("SM_WarehouseOUT_Red.aspx?FLAG=OPEN&&ID=" + LabelCode.Text);
            }

            if (Convert.ToInt32(cmd.Parameters["@retVal"].Value) == -1)
            {
                string script = @"alert('审核未通过:未审核的出库单无法反审!');";

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "error", script, true);

                return;
            }
            if (Convert.ToInt32(cmd.Parameters["@retVal"].Value) == 1)
            {
                string script = @"alert('审核未通过:入库物料发生后续操作!');";

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "error", script, true);

                return;
            }

            if (Convert.ToInt32(cmd.Parameters["@retVal"].Value) == 2)
            {
                string script = @"alert('审核未通过:部分入库物料发生后续操作!');";

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "error", script, true);

                return;
            }
        }
Beispiel #21
0
 protected void btnupload2_Click(object sender, EventArgs e)
 {
     if (FileUploadupdate.HasFile)
     {
         string datatime         = DateTime.Now.Year.ToString() + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".jpg";
         string webfilepath      = Server.MapPath("~/staff_images/" + datatime);
         string filecontent_type = FileUploadupdate.PostedFile.ContentType;
         if (filecontent_type == "image/bmp" || filecontent_type == "image/gif" || filecontent_type == "image/jpeg" || filecontent_type == "image/jpg" || filecontent_type == "image/pjpeg")
         {
             if (!File.Exists(webfilepath))
             {
                 try
                 {
                     FileUploadupdate.SaveAs(webfilepath);
                     lblupdate.Visible  = true;
                     lblupdate.Text     = "上传成功";
                     showImage.ImageUrl = "~/staff_images/" + datatime;
                     SqlCommand sqlCmd = new SqlCommand();
                     sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                     sqlCmd.CommandText       = "update TBDS_STAFFINFO set JPGURL=@filename where ST_NAME=" + "'" + ST_NAME.Text + "'";
                     sqlCmd.Parameters.Clear();
                     sqlCmd.Parameters.AddWithValue("@filename", datatime);
                     sqlCmd.Connection = sqlConn;
                     sqlConn.Open();
                     sqlCmd.ExecuteNonQuery();
                     sqlConn.Close();
                 }
                 catch (Exception ex)
                 {
                     lblupload2.Visible = true;
                     lblupload2.Text    = "文件上传失败" + ex.Message;
                 }
             }
             else
             {
                 lblupload2.Visible = true;
                 lblupload2.Text    = "文件已经存在,请重新命名";
             }
         }
         else
         {
             lblupload2.Visible = true;
             lblupload2.Text    = "文件类型不符,请重新上传";
         }
     }
     else
     {
         lblupload2.Visible = true;
         lblupload2.Text    = "请选择文件或输入文件路径及名称";
     }
 }
        private void insertinitialdata()
        {
            string        sqltext = "";
            SqlConnection sqlConn = new SqlConnection();
            SqlCommand    sqlCmd  = new SqlCommand();

            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            sqlConn.Open();
            sqlCmd.Connection = sqlConn;
            generate_caigoudan(DropDownList_PJ.SelectedValue.ToString(), downlist_eng.SelectedValue.ToString());
            int i = 0;

            foreach (RepeaterItem Reitem in billsummarizingRepeater.Items)
            {
                i++;
                sqltext = "INSERT INTO TBPC_PURCHASEPLAN(PUR_PCODE,PUR_PJID,PUR_PJNAME,PUR_ENGID,PUR_ENGNAME,PUR_PTCODE,PUR_MARID,PUR_MARNAME,PUR_MARNORM,PUR_MARTERIAL,PUR_FIXEDSIZE,PUR_NUM,PUR_NUNIT,PUR_USTNUM,PUR_RPNUM,PUR_PUNIT,PUR_STDATE,PUR_PRONODE,PUR_STATE) " +
                          "VALUES(@PUR_PCODE,@PUR_PJID,@PUR_PJNAME,@PUR_ENGID,@PUR_ENGNAME,@PUR_PTCODE,@PUR_MARID,@PUR_MARNAME,@PUR_MARNORM,@PUR_MARTERIAL,@PUR_FIXEDSIZE,@PUR_NUM,@PUR_NUNIT,@PUR_USTNUM,@PUR_RPNUM,@PUR_PUNIT,@PUR_STDATE,@PUR_PRONODE,@PUR_STATE)";
                sqlCmd.CommandText = sqltext;
                sqlCmd.Parameters.Clear();
                sqlCmd.Parameters.AddWithValue("@PUR_PCODE", TextBox_pid.Text.ToString());
                sqlCmd.Parameters.AddWithValue("@PUR_PJID", DropDownList_PJ.SelectedValue.ToString());
                sqlCmd.Parameters.AddWithValue("@PUR_PJNAME", DropDownList_PJ.SelectedItem.Text);
                sqlCmd.Parameters.AddWithValue("@PUR_ENGID", downlist_eng.SelectedValue.ToString());
                sqlCmd.Parameters.AddWithValue("@PUR_ENGNAME", downlist_eng.SelectedItem.Text);
                sqlCmd.Parameters.AddWithValue("@PUR_PTCODE", TextBox_pid.Text.ToString() + "_" + i.ToString().PadLeft(4, '0'));
                sqlCmd.Parameters.AddWithValue("@PUR_MARID", ((Label)Reitem.FindControl("PUR_MARID")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_MARNAME", ((Label)Reitem.FindControl("PUR_MARNAME")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_MARNORM", ((Label)Reitem.FindControl("PUR_MARNORM")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_MARTERIAL", ((Label)Reitem.FindControl("PUR_MARTERIAL")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_FIXEDSIZE", ((Label)Reitem.FindControl("PUR_FIXEDSIZE")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_NUM", ((Label)Reitem.FindControl("PUR_NEDDNUM")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_NUNIT", ((Label)Reitem.FindControl("PUR_NUNIT")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_USTNUM", '0');
                sqlCmd.Parameters.AddWithValue("@PUR_RPNUM", ((Label)Reitem.FindControl("PUR_NEDDNUM")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_PUNIT", ((Label)Reitem.FindControl("PUR_NUNIT")).Text.Replace(" ", ""));
                sqlCmd.Parameters.AddWithValue("@PUR_STDATE", DateTime.Now.ToString("yyyy-MM-dd"));
                sqlCmd.Parameters.AddWithValue("@PUR_PRONODE", '0');
                sqlCmd.Parameters.AddWithValue("@PUR_STATE", '0');
                int rowsnum = sqlCmd.ExecuteNonQuery();
            }
            string sqltext1 = "INSERT INTO TBPC_PCHSPLANRVW(PR_SHEETNO,PR_REVIEWA,PR_REVIEWANM,PR_REVIEWATIME,PR_STATE,PR_PRONODE) " +
                              "VALUES('" + TextBox_pid.Text.ToString() + "' ,'" + TextBoxexecutorid.Text.ToString() + "','" + TextBoxexecutor.Text.ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','000','0')";

            DBCallCommon.ExeSqlText(sqltext1);
            string sqltext2 = "UPDATE TBPM_MPFORALLRVW SET MP_STATE='9',MP_PRSHEETNO='" + TextBox_pid.Text.ToString() + "' WHERE MP_STATE='8' AND MP_PJID='" + DropDownList_PJ.SelectedValue.ToString() + "' AND MP_ENGID='" + downlist_eng.SelectedValue.ToString() + "'";

            DBCallCommon.ExeSqlText(sqltext2);
            DBCallCommon.closeConn(sqlConn);
            Response.Redirect("~/PC_Data/PC_TBPC_Purchaseplan_check_list.aspx");
        }
Beispiel #23
0
        private CR_NotContractOrder_DataSet BingCQData(string dq_id)
        {
            string sqlText = "select DQ_ID,DQ_DATA,DQ_QKBM,DQ_BMNAME,DQ_QKR,DQ_USE,DQ_DDCODE,DQ_DDZJE,DQ_CSCODE,DQ_CSNAME,DQ_CSBANK,DQ_CSACCOUNT,DQ_AMOUNT,DQ_AMOUNTDX,DQ_ZFFS,DQ_BILLCODE,DQ_STATE,DQ_BMYJ,DQ_ZGLD,DQ_GSLD,DQ_CWSH,DQ_NOTE from TBPM_ORDER_CHECKREQUEST";

            sqlText += " where DQ_ID='" + dq_id + "'";
            CR_NotContractOrder_DataSet ds = new CR_NotContractOrder_DataSet();
            SqlConnection sqlConn          = new SqlConnection();

            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            SqlDataAdapter sda = new SqlDataAdapter(sqlText, sqlConn);

            sda.Fill(ds, "TBPM_ORDER_CHECKREQUEST");
            return(ds);
        }
        /// <summary>
        /// 绑定汇总后数据(页面上汇总)
        /// </summary>
        private void GetCollList(string ddlselectedType)
        {
            this.InitList();
            string        sql_select_type = "select MP_MASHAPE from " + mptable + " where MP_ID='" + mp_no.Value + "' ";
            string        matype          = "";//提交的该批材料计划类别:非定尺板、定尺板、型材、标(发运)、标(组装)
            SqlDataReader dr = DBCallCommon.GetDRUsingSqlText(sql_select_type);

            if (dr.HasRows)
            {
                dr.Read();
                matype = dr["MP_MASHAPE"].ToString();
                dr.Close();
            }



            DataTable dt = new DataTable();

            if (viewtable == "View_TM_MPCHANGE")  //变更
            {
            }
            else  //正常
            {
                try
                {
                    SqlConnection sqlConn = new SqlConnection();
                    SqlCommand    sqlCmd  = new SqlCommand();
                    sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                    DBCallCommon.PrepareStoredProc(sqlConn, sqlCmd, "TM_MP_COLLECT");
                    DBCallCommon.AddParameterToStoredProc(sqlCmd, "@Table_Name", viewtable, SqlDbType.VarChar, 1000);
                    DBCallCommon.AddParameterToStoredProc(sqlCmd, "@PiHao", mp_no.Value, SqlDbType.VarChar, 1000);
                    DBCallCommon.AddParameterToStoredProc(sqlCmd, "@WhereCon", ddlselectedType, SqlDbType.VarChar, 1000);

                    dt = DBCallCommon.GetDataTableUsingCmd(sqlCmd);
                    sqlConn.Close();
                }
                catch (Exception)
                {
                    throw;
                }
            }


            GridView2.DataSource = dt;
            GridView2.DataBind();


            InitDataPanel(GridView2);
        }
Beispiel #25
0
        public String[] GetCusupinfo(string prefixText, int count)
        {
            ///检测参数是否为空

            if (string.IsNullOrEmpty(prefixText) == true || count <= 0)
            {
                return(null);
            }

            // 如果数组为空
            if (autoCompleteWordList == null)
            {
                //读取数据库的内容
                SqlConnection sqlConn = new SqlConnection();
                sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                sqlConn.Open();
                DataTable dt      = new DataTable();
                string    sqltext = "";
                //2为供应商
                sqltext = "SELECT CS_NAME + ' | ' + CS_CODE + ' | ' + CS_HRCODE  AS Expr1 " +
                          "FROM TBCS_CUSUPINFO WHERE (CS_TYPE='2' OR CS_TYPE='3') and  (" +
                          "CS_HRCODE LIKE '%" + prefixText + "%') ORDER BY CS_CODE";
                //"CS_HRCODE LIKE '%" + prefixText + "%') AND CS_State='0' ORDER BY CS_CODE";
                dt = DBCallCommon.GetDTUsingSqlText(sqltext);
                //读取内容文件的数据到临时数组
                string[] temp = new string[dt.Rows.Count];
                int      i    = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    temp[i] = dr["Expr1"].ToString();
                    i++;
                }
                Array.Sort(temp, new CaseInsensitiveComparer());
                //将临时数组的内容赋给返回数组
                autoCompleteall = temp;
                if (sqlConn.State == ConnectionState.Open)
                {
                    sqlConn.Close();
                }
            }
            int matchCount = autoCompleteall.Length >= count ? count : autoCompleteall.Length;

            string[] matchResultList = new string[matchCount];
            if (matchCount > 0)
            {   //复制搜索结果
                Array.Copy(autoCompleteall, 0, matchResultList, 0, matchCount);
            }
            return(matchResultList);
        }
Beispiel #26
0
        /*
         * 合并
         */

        protected void Merge_Click(object sender, EventArgs e)
        {
            string code   = Request.QueryString["IDC"].ToString();
            string constr = DBCallCommon.GetStringValue("connectionStrings");

            SqlConnection con = new SqlConnection(constr);

            con.Open();
            SqlCommand cmd = new SqlCommand("MergeOut", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@sOutCode", SqlDbType.VarChar, 50);     //增加参数入库单号@InCode
            cmd.Parameters["@sOutCode"].Value = code;                   //为参数初始化
            cmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue;
            cmd.ExecuteNonQuery();
            con.Close();

            if (Convert.ToInt32(cmd.Parameters["@retVal"].Value) == 0)
            {
                LabelResult.Text = "合并成功!";

                Merge.Enabled = false;

                Back.Visible = false;

                Close.Visible = true;//关闭显示

                GridView1.Visible = false;

                string parentcode = Request.QueryString["IDP"].ToString();

                constr = "SELECT UniqueCode AS UniqueID,SQCODE AS SQCODE,MaterialCode AS MaterialCode,MaterialName AS MaterialName," +
                         "Attribute AS Attribute,GB AS GB,Standard AS MaterialStandard,Fixed AS Fixed,Length AS Length,Width AS Width," +
                         "LotNumber AS LotNumber,Unit AS Unit,cast(RealNumber as float) AS RN,cast(RealSupportNumber as float) AS RQN," +
                         "cast(UnitPrice as float) AS UnitPrice,cast(Amount as float) AS Amount," +
                         "Warehouse AS Warehouse,Location AS Position," +
                         "PTC AS PTC,DetailNote AS Comment " +
                         " FROM View_SM_OUT WHERE OutCode='" + parentcode + "' ORDER BY UniqueCode ";
                DataTable dt = DBCallCommon.GetDTUsingSqlText(constr);
                GridView2.DataSource = dt;
                GridView2.DataBind();
            }
            else
            {
                LabelResult.ForeColor = Color.Red;
                LabelResult.Text      = "合并失败!";
            }
        }
Beispiel #27
0
        /*
         * 合并
         */

        protected void Merge_Click(object sender, EventArgs e)
        {
            string subcode = Request.QueryString["IDC"].ToString(); //子单
            string constr  = DBCallCommon.GetStringValue("connectionStrings");

            SqlConnection con = new SqlConnection(constr);

            con.Open();
            SqlCommand cmd = new SqlCommand("MTOMerge", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@SubMTOCode", SqlDbType.VarChar, 50);   //增加参数入库单号@InCode
            cmd.Parameters["@SubMTOCode"].Value = subcode;              //为参数初始化,子单号
            cmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue;
            cmd.ExecuteNonQuery();
            con.Close();
            if (Convert.ToInt32(cmd.Parameters["@retVal"].Value) == 0)
            {
                LabelResult.Text = "合并成功!";

                Merge.Enabled = false;

                Back.Visible = false;

                Close.Visible = true;//关闭显示

                GridView1.Visible = false;
                string parentcode = Request.QueryString["IDP"].ToString();

                constr = "SELECT MaterialCode AS MaterialCode,MaterialName AS MaterialName," +
                         "Attribute AS Attribute,GB AS GB,Standard AS MaterialStandard," +
                         "Fixed AS Fixed,Length AS Length,Width AS Width," +
                         "LotNumber AS LotNumber,Unit AS Unit,cast(TZNUM as float) AS TZN,cast(TZFZNUM as float) AS TZQuantity," +
                         "PTCFrom AS PTCFrom,PTCTo AS PTCTo," +
                         "Warehouse AS Warehouse,Location AS Position," +
                         "OrderCode AS OrderCode,PlanMode AS PlanMode,DetailNote AS Comment" +
                         " FROM View_SM_MTO WHERE MTOCode='" + parentcode + "'";
                DataTable dt = DBCallCommon.GetDTUsingSqlText(constr);
                GridView2.DataSource = dt;
                GridView2.DataBind();
            }
            else
            {
                LabelResult.ForeColor = Color.Red;
                LabelResult.Text      = "合并失败!";
            }
        }
Beispiel #28
0
        //private void getZanGuBuCha() //获取暂估差金额,,入库单金额=发票金额-暂估差
        //{
        //    //核算后获取发票金额

        //    //暂估差额
        //    string strperiod = ddl_year.SelectedValue + "-" + ddl_month.SelectedValue;
        //    string condition = "CONVERT(varchar(100),(DIFYEAR+'-'+DIFMONTH), 23)  between '" + strperiod + "' and '" + strperiod + "'AND round(DIFAMTMNY,2)!=0";

        //    string sql = "select  CAST(round(isnull(sum(DIFAMTMNY),0),2) AS FLOAT) as TotalAmount from View_FM_INHSDETAILDIFMAR where " + condition;

        //    SqlDataReader sdr = DBCallCommon.GetDRUsingSqlText(sql);

        //    if (sdr.Read())
        //    {
        //        hfdZanGuChaAmount.Value = sdr["TotalAmount"].ToString();

        //    }

        //    sdr.Close();
        //}

        /*****************************入库核算***************************/
        protected void btn_hs_Click(object sender, EventArgs e)
        {
            string    sqlifrksh = "select * from View_SM_IN where WG_STATE<>'2'";
            DataTable dtifrksh  = DBCallCommon.GetDTUsingSqlText(sqlifrksh);

            if (dtifrksh.Rows.Count > 0)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('存在未审核的入库单!')", true);
                return;
            }



            SqlConnection sqlConn = new SqlConnection();

            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            DBCallCommon.openConn(sqlConn);
            SqlCommand sqlCmd = new SqlCommand("GouJiRuKuHeSuan", sqlConn);

            sqlCmd.CommandType    = CommandType.StoredProcedure;
            sqlCmd.CommandTimeout = 0;
            sqlCmd.Parameters.Add("@gmonth", SqlDbType.VarChar, 2);
            sqlCmd.Parameters["@gmonth"].Value = getMonth();

            sqlCmd.Parameters.Add("@gyear", SqlDbType.VarChar, 4);
            sqlCmd.Parameters["@gyear"].Value = getYear();

            sqlCmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue;                      //增加返回值参数@retVal

            sqlCmd.ExecuteNonQuery();

            DBCallCommon.closeConn(sqlConn);

            if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 0)
            {
                string script = @"alert('入库核算成功!');location.href ='FM_RuKu_Adjust_Accounts.aspx'";

                ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true);
            }
            else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 1)
            {
                string script = @"alert('入库核算失败!');'";

                ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true);
            }
        }
Beispiel #29
0
        public string[] GetCompletebytsaid(string prefixText, int count)
        {
            ///检测参数是否为空

            if (string.IsNullOrEmpty(prefixText) == true || count <= 0)
            {
                return(null);
            }

            // 如果数组为空
            if (autoCompleteWordList == null)
            {
                //读取数据库的内容
                SqlConnection sqlConn = new SqlConnection();
                sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
                sqlConn.Open();
                DataSet   ds    = new DataSet();
                DataTable glotb = new DataTable();
                ds = DBCallCommon.FillDataSet("SELECT distinct TSA_ID  as Expr1 from  View_CM_FaHuo  WHERE TSA_ID LIKE '%" + prefixText.Trim() + "%'");
                glotb.Merge(ds.Tables[0]);
                glotb.AcceptChanges();
                //读取内容文件的数据到临时数组
                string[] temp = new string[glotb.Rows.Count];
                int      i    = 0;
                foreach (DataRow dr in glotb.Rows)
                {
                    temp[i] = dr["Expr1"].ToString();
                    i++;
                }
                Array.Sort(temp, new CaseInsensitiveComparer());
                autoCompleteall = temp;
                //将临时数组的内容赋给返回数组
                if (sqlConn.State == ConnectionState.Open)
                {
                    sqlConn.Close();
                }
            }
            int matchCount = autoCompleteall.Length >= count ? count : autoCompleteall.Length;

            string[] matchResultList = new string[matchCount];
            if (matchCount > 0)
            {   //复制搜索结果
                Array.Copy(autoCompleteall, 0, matchResultList, 0, matchCount);
            }
            return(matchResultList);
        }
Beispiel #30
0
        protected void Showdata()                                          //显示出数据
        {
            string st_codestr = Request.QueryString["ST_CODE"].ToString(); //得到修改人员编码

            ST_CODE.Text = st_codestr;
            ///Session["code"] = st_codestr;                                  //保存编码
            sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings");
            SqlCommand sqlCmd = new SqlCommand("select * from TBDS_STAFFINFO where ST_ID='" + ST_CODE.Text + "'", sqlConn);

            sqlConn.Open();
            SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);

            if (dr.Read())                                                             //设置修改人员的初始值
            {
                setdeplistvalue(dr["ST_CODE"].ToString());                             //根据ST_DEPID设置部门下拉框的值
                ST_CODE.Text     = dr["ST_CODE"].ToString();
                ST_NAME.Text     = dr["ST_NAME"].ToString();
                ST_MANCLERK.Text = dr["ST_MANCLERK"].ToString();
                DropDownListgender.SelectedValue = dr["ST_GENDER"].ToString();
                ST_POSITION.Text = dr["ST_POSITION"].ToString();
                ST_SEQUEN.Text   = dr["ST_SEQUEN"].ToString();
                ST_NOTE.Text     = dr["ST_NOTE"].ToString();
                ST_FILLDATE.Text = dr["ST_FILLDATE"].ToString();
                DropDownListdept.SelectedValue = dr["ST_DEPID"].ToString();
                TextBoxdept.Text   = DropDownListdept.SelectedItem.Text;
                ST_IDCARD.Text     = dr["ST_IDCARD"].ToString();
                ST_TELE.Text       = dr["ST_TELE"].ToString();
                ST_REGIST.Text     = dr["ST_REGIST"].ToString();
                ST_MARRY.Text      = dr["ST_MARRY"].ToString();
                ST_POLITICAL.Text  = dr["ST_POLITICAL"].ToString();
                ST_AGE.Text        = dr["ST_AGE"].ToString();
                showImage.ImageUrl = "~/staff_images/" + dr["JPGURL"].ToString();
                int i = 26;
                foreach (Control control in Panel4.Controls)
                {
                    if (control is TextBox)
                    {
                        ((TextBox)control).Text = dr[i].ToString();
                        i++;
                    }
                }
            }
            dr.Close();
            //sqlConn.Close();
            Console.WriteLine("读取完毕后的连接状态:" + sqlConn.State.ToString());
        }