示例#1
0
        protected void gridMaterial_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            if (e.VisibleIndex < 0)
            {
                return;
            }
            if (Session["replaceType"].ToString() == "oneReplace")
            {
                //如果bom里有匹配物料替换设定一对一替换的,显示替换按钮
                ASPxGridView grid         = (ASPxGridView)sender;
                string       itemCode     = grid.GetRowValues(e.VisibleIndex, "ITEM_CODE") as string;
                string       newPart      = grid.GetRowValues(e.VisibleIndex, "NEWPART") as string;
                string       locationCode = grid.GetRowValues(e.VisibleIndex, "LOCATION_CODE") as string;

                //已经替换的不显示按钮
                string sql = "select * from sjbomsoth where ljdm1='" + itemCode + "' and ljdm2='" + newPart + "' and jhdm='" + Session["planCode"].ToString()
                             + "' and so='" + Session["so"].ToString() + "'  and gwmc='" + locationCode + "' and gzdd='" + Session["plineCode"].ToString() + "'";
                bool useFlag = dc.GetState(sql);

                if (e.ButtonID == "OneReplace")
                {
                    if (newPart == "" || useFlag == true)
                    {
                        e.Visible = DefaultBoolean.False;
                    }
                }
                if (e.ButtonID == "MultiReplace")
                {
                    e.Visible = DefaultBoolean.False;
                }
            }

            //显示多对多替换按钮
            if (Session["replaceType"].ToString() == "multiReplace")
            {
                //如果bom里有匹配物料替换设定一对一替换的,显示替换按钮
                ASPxGridView grid     = (ASPxGridView)sender;
                string       comment1 = grid.GetRowValues(e.VisibleIndex, "COMMENT1") as string;
                if (e.ButtonID == "MultiReplace")
                {
                    if (comment1 == "多重替换")
                    {
                        e.Visible = DefaultBoolean.True;
                    }
                    else
                    {
                        e.Visible = DefaultBoolean.False;
                    }
                }
                if (e.ButtonID == "OneReplace")
                {
                    e.Visible = DefaultBoolean.False;
                }
            }
        }
示例#2
0
    protected void ASPxGridView1_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
    {
        //判断超长
        if (e.NewValues["PROCESS_CODE"].ToString().Length > 30)
        {
            e.RowError = "工序代码字节长度不能超过30!";
        }
        if (e.NewValues["PROCESS_NAME"].ToString().Length > 30)
        {
            e.RowError = "工序名称字节长度不能超过30!";
        }
        //判断为空
        if (e.NewValues["PROCESS_CODE"].ToString() == "" || e.NewValues["PROCESS_CODE"].ToString() == null)
        {
            e.RowError = "工序代码不能为空!";
        }
        if (e.NewValues["PROCESS_NAME"].ToString() == "" || e.NewValues["PROCESS_NAME"].ToString() == null)
        {
            e.RowError = "工序名称不能为空!";
        }



        //新增判断键值重复
        if (ASPxGridView1.IsNewRowEditing)
        {
            string chSql = "SELECT COMPANY_CODE, PROCESS_CODE, PROCESS_NAME, PLINE_CODE FROM CODE_PROCESS"
                           + " WHERE COMPANY_CODE = '" + companyCode + "' and PROCESS_CODE='" + e.NewValues["PROCESS_CODE"].ToString() + "'";
            dataConn dc = new dataConn(chSql);
            if (dc.GetState() == true)
            {
                e.RowError = "已存在相同的工序代码!";
            }
        }
    }
示例#3
0
    protected void ASPxGridView1_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
    {
        //判断超长
        if (e.NewValues["LOCATION_CODE"].ToString().Length > 30)
        {
            e.RowError = "工位代码字节长度不能超过30!";
        }
        if (e.NewValues["LOCATION_NAME"].ToString().Length > 30)
        {
            e.RowError = "工位名称字节长度不能超过30!";
        }
        //判断为空
        if (e.NewValues["LOCATION_CODE"].ToString() == "" || e.NewValues["LOCATION_CODE"].ToString() == null)
        {
            e.RowError = "工位代码不能为空!";
        }
        if (e.NewValues["LOCATION_NAME"].ToString() == "" || e.NewValues["LOCATION_NAME"].ToString() == null)
        {
            e.RowError = "工位名称不能为空!";
        }
        if (e.NewValues["LOCATION_SEQ"].ToString() == "" || e.NewValues["LOCATION_SEQ"].ToString() == null)
        {
            e.RowError = "工位顺序不能为空!";
        }
        if (e.NewValues["LOCATION_MANHOUR"].ToString() == "" || e.NewValues["LOCATION_MANHOUR"].ToString() == null)
        {
            e.RowError = "工时不能为空!";
        }


        //判断是否为数字

        //工位顺序要求为整数
        if (thePubCs.IsNumeric(e.NewValues["LOCATION_SEQ"].ToString()) == false)
        {
            e.RowError = "工位顺序必须为整数!";
        }

        //工时要求为整数
        if (thePubCs.IsValidNumber(e.NewValues["LOCATION_MANHOUR"].ToString()) == false)
        {
            e.RowError = "工时必须为数字!";
        }

        //新增判断键值重复
        if (ASPxGridView1.IsNewRowEditing)
        {
            string chSql = "SELECT COMPANY_CODE, LOCATION_CODE, LOCATION_NAME, LOCATION_SEQ," +
                           "LOCATION_MANHOUR,PLINE_CODE FROM CODE_LOCATION"
                           + " WHERE COMPANY_CODE = '" + companyCode + "' and LOCATION_CODE='" + e.NewValues["LOCATION_CODE"].ToString() + "'";
            dataConn dc = new dataConn(chSql);
            if (dc.GetState() == true)
            {
                e.RowError = "已存在相同的工位代码!";
            }
        }
    }
示例#4
0
    protected void ASPxGridView1_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
    {
        //判断超长


        //string aa = e.NewValues["STATION_SPECIAL_CODE"].ToString();
        //string bb = e.NewValues["STATION_SPECIAL_NAME"].ToString();


        //string cc = e.NewValues["PLINE_CODE"].ToString();


        ASPxComboBox PlineCode = ASPxGridView1.FindEditFormTemplateControl("PlineCombo") as ASPxComboBox;

        if (e.NewValues["STATION_SPECIAL_CODE"].ToString().Length > 30)
        {
            e.RowError = "特殊站点代码字节长度不能超过30!";
        }
        if (e.NewValues["STATION_SPECIAL_NAME"].ToString().Length > 30)
        {
            e.RowError = "特殊站点名称字节长度不能超过30!";
        }
        //判断为空
        if (e.NewValues["STATION_SPECIAL_CODE"].ToString() == "" || e.NewValues["STATION_SPECIAL_CODE"].ToString() == null)
        {
            e.RowError = "特殊站点代码不能为空!";
        }
        if (e.NewValues["STATION_SPECIAL_NAME"].ToString() == "" || e.NewValues["STATION_SPECIAL_NAME"].ToString() == null)
        {
            e.RowError = "特殊站点名称不能为空!";
        }



        //新增判断键值重复
        if (ASPxGridView1.IsNewRowEditing)
        {
            string chSql = "SELECT COMPANY_CODE, STATION_SPECIAL_CODE, STATION_SPECIAL_NAME, STATION_CODE," +
                           "PLINE_CODE FROM CODE_STATION_SPECIAL"
                           + " WHERE COMPANY_CODE = '" + companyCode + "' and STATION_SPECIAL_CODE='" + e.NewValues["STATION_SPECIAL_CODE"].ToString() + "'" +
                           " and PLINE_CODE='" + PlineCode.Value.ToString() + "'";
            dataConn dc = new dataConn(chSql);
            if (dc.GetState() == true)
            {
                e.RowError = "已存在相同的特殊站点代码,请确认后重新输入!";
            }
        }



        FillStationCodeCombo(PlineCode.Value.ToString());
    }
示例#5
0
    // 数据校验
    protected void ASPxGridView1_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
    {
        //判断超长
        if (e.NewValues["TEAM_CODE"].ToString().Length > 15)
        {
            e.RowError = "班组代码字节长度不能超过15!";
        }
        if (e.NewValues["TEAM_NAME"].ToString().Length > 15)
        {
            e.RowError = "班组名称字节长度不能超过15!";
        }
        if (e.NewValues["PLINE_CODE"].ToString().Length > 15)
        {
            e.RowError = "生产线字节长度不能超过15!";
        }
        //判断为空
        if (e.NewValues["TEAM_CODE"].ToString() == "" || e.NewValues["TEAM_CODE"].ToString() == null)
        {
            e.RowError = "班组代码不能为空!";
        }
        if (e.NewValues["TEAM_NAME"].ToString() == "" || e.NewValues["TEAM_NAME"].ToString() == null)
        {
            e.RowError = "班组名称不能为空!";
        }
        if (e.NewValues["PLINE_CODE"].ToString() == "" || e.NewValues["PLINE_CODE"].ToString() == null)
        {
            e.RowError = "生产线不能为空!";
        }
        if (e.NewValues["LEADER_CODE"].ToString() == "" || e.NewValues["LEADER_CODE"].ToString() == null)
        {
            e.RowError = "班组长不能为空!";
        }

        //新增判断键值重复
        if (ASPxGridView1.IsNewRowEditing)
        {
            string chSql = "SELECT COMPANY_CODE, TEAM_CODE FROM CODE_TEAM"
                           + " WHERE COMPANY_CODE = '" + theCompanyCode + "' AND TEAM_CODE='" + e.NewValues["TEAM_CODE"].ToString() + "'";
            dataConn dc = new dataConn(chSql);
            if (dc.GetState() == true)
            {
                e.RowError = "已存在相同的班组代码!";
            }
        }
    }
示例#6
0
        protected void ASPxGridView2_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
        {
            //判断超长
            if (e.NewValues["ALINE_CODE"].ToString().Length > 30)
            {
                e.RowError = "跨线模式代码字节长度不能超过30!";
            }
            if (e.NewValues["ALINE_NAME"].ToString().Length > 50)
            {
                e.RowError = "跨线模式名称字节长度不能超过50!";
            }
            if (e.NewValues["PLINE_ID"].ToString().Length > 30)
            {
                e.RowError = "生产线字节长度不能超过30!";
            }
            //判断为空
            if (e.NewValues["ALINE_CODE"].ToString() == "" || e.NewValues["ALINE_CODE"].ToString() == null)
            {
                e.RowError = "跨线模式代码不能为空!";
            }
            if (e.NewValues["ALINE_NAME"].ToString() == "" || e.NewValues["ALINE_NAME"].ToString() == null)
            {
                e.RowError = "跨线模式名称不能为空!";
            }
            if (e.NewValues["PLINE_ID"].ToString() == "" || e.NewValues["PLINE_ID"].ToString() == null)
            {
                e.RowError = "生产线不能为空!";
            }

            //新增判断键值重复
            if (ASPxGridView2.IsNewRowEditing)
            {
                string chSql = "select COMPANY_CODE,ALINE_CODE,ALINE_NAME,PLINE_ID,PLINE_CODE,PLINE_NAME FROM ATPU_ACROSSLINE"
                               + " WHERE COMPANY_CODE = '" + theCompanyCode + "' and ALINE_CODE='" + e.NewValues["ALINE_CODE"].ToString() + "'";
                dataConn dc = new dataConn(chSql);
                if (dc.GetState() == true)
                {
                    e.RowError = "已存在相同的跨线模式代码!";
                }
            }
        }
示例#7
0
        protected void butConfirm_Click(object sender, EventArgs e)
        {
            string pline, subStation, cfStation, zpStation, subZc, cFlag = "";
            string subStationCode = "";
            string sunStationName = "";

            pline      = comboPlineCode.SelectedItem.Value.ToString();
            subStation = comboSUBStation.SelectedItem.Value.ToString();

            string    sql = "select station_code,station_name from code_station where rmes_id='" + subStation + "'";
            dataConn  cdc = new dataConn(sql);
            DataTable cdt = cdc.GetTable();

            if (cdt.Rows.Count > 0)
            {
                subStationCode = cdt.Rows[0]["station_code"].ToString();
                sunStationName = cdt.Rows[0]["station_name"].ToString();
            }

            cfStation = comboCFStation.SelectedItem.Value.ToString();
            zpStation = comboZPStation.SelectedItem.Value.ToString();
            subZc     = txtPlineCode.Text.Trim();
            if (subZc != "")
            {
                if (comboCFlag.SelectedIndex >= 0)
                {
                    cFlag = comboCFlag.SelectedItem.Value.ToString();
                }
            }

            string   chSql = "select PT_PART from COPY_PT_MSTR where PT_PART='" + subZc + "' ";
            dataConn chDc  = new dataConn(chSql);
            Boolean  t     = chDc.GetState();
            //if (subZc == "")//subZc!=""&&chDc.GetState() == false
            //{
            //    lblMessage.Text = "录入的分装总成号" + subZc + "错误!";
            //}
            //else
            {
                //取RMES_ID的值
                string sql_rmes_id = "SELECT SEQ_RMES_ID.NEXTVAL FROM DUAL ";
                dc.setTheSql(sql_rmes_id);
                string rmes_id = dc.GetTable().Rows[0][0].ToString();

                string inSql = "insert into CODE_STATION_SUB (RMES_ID,COMPANY_CODE,PLINE_CODE,SUBSTATION_ID,SUBSTATION_CODE,SUBSTATION_NAME,"
                               + "CFSTATION_ID,ZPSTATION_ID,SUB_ZC,CHECK_FLAG,INPUT_PERSON,INPUT_TIME) values('" + rmes_id + "','" + theCompanyCode + "','" + pline + "',"
                               + "'" + subStation + "','" + subStationCode + "','" + sunStationName + "','" + cfStation + "','" + zpStation + "','" + subZc + "','" + cFlag + "','" + theUserId + "',SYSDATE)";
                dc.ExeSql(inSql);

                //插入到日志表
                try
                {
                    string Sql2 = "INSERT INTO CODE_STATION_SUB_LOG (RMES_ID,COMPANY_CODE,PLINE_CODE,SUBSTATION_ID,SUBSTATION_CODE,SUBSTATION_NAME,"
                                  + "CFSTATION_ID,ZPSTATION_ID,SUB_ZC,CHECK_FLAG,user_code,flag,rqsj)"
                                  + " SELECT RMES_ID,COMPANY_CODE,PLINE_CODE,SUBSTATION_ID,SUBSTATION_CODE,SUBSTATION_NAME,"
                                  + "CFSTATION_ID,ZPSTATION_ID,SUB_ZC,CHECK_FLAG,'" + theUserCode + "' , 'ADD', SYSDATE FROM CODE_STATION_SUB WHERE RMES_ID='" + rmes_id + "'";
                    dc.ExeSql(Sql2);
                }
                catch
                {
                    return;
                }

                Response.Write("<script type='text/javascript'>alert('新增分装工作站取点成功!');window.opener.location.reload();location.href='epd3A01.aspx';</script>");
            }
        }
示例#8
0
    // 数据校验
    protected void ASPxGridView1_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
    {
        //判断超长
        if (e.NewValues["PROGRAM_CODE"].ToString().Length > 50)
        {
            e.RowError = "程序代码字节长度不能超过50!";
        }
        if (e.NewValues["PROGRAM_NAME"].ToString().Length > 50)
        {
            e.RowError = "程序名称字节长度不能超过50!";
        }
        if (e.NewValues["PROGRAM_NAME_EN"].ToString().Length > 50)
        {
            e.RowError = "英文缩写字节长度不能超过50!";
        }
        if (e.NewValues["PROGRAM_VALUE"].ToString().Length > 500)
        {
            e.RowError = "链接地址字节长度不能超过500!";
        }
        //判断为空
        //if (e.NewValues["PROGRAM_CODE"].ToString()=="" || e.NewValues["PROGRAM_CODE"].ToString()==null )
        //{
        //    e.RowError = "程序代码不能为空!";
        //}
        if (e.NewValues["PROGRAM_NAME"].ToString() == "" || e.NewValues["PROGRAM_NAME"].ToString() == null)
        {
            e.RowError = "程序名称不能为空!";
        }
        if (e.NewValues["PROGRAM_NAME_EN"].ToString() == "" || e.NewValues["PROGRAM_NAME_EN"].ToString() == null)
        {
            e.RowError = "英文缩写不能为空!";
        }
        if (e.NewValues["PROGRAM_VALUE"].ToString() == "" || e.NewValues["PROGRAM_VALUE"].ToString() == null)
        {
            e.RowError = "链接地址不能为空!";
        }
        //新增判断键值重复
        if (ASPxGridView1.IsNewRowEditing)
        {
            string chSql = "SELECT COMPANY_CODE, PROGRAM_CODE, PROGRAM_NAME, PROGRAM_NAME_EN, PROGRAM_VALUE, RIGHT_FLAG FROM CODE_PROGRAM"
                           + " WHERE COMPANY_CODE = '" + theCompanyCode + "' AND PROGRAM_CODE='" + e.NewValues["PROGRAM_CODE"].ToString() + "'";
            dataConn dc = new dataConn(chSql);
            if (dc.GetState() == true)
            {
                e.RowError = "已存在相同的程序代码!";
            }
        }
        //判断program_value不能重复
        string chSqlV = "SELECT COMPANY_CODE, PROGRAM_CODE, PROGRAM_NAME, PROGRAM_NAME_EN, PROGRAM_VALUE, RIGHT_FLAG FROM CODE_PROGRAM"
                        + " WHERE COMPANY_CODE = '" + theCompanyCode + "' AND PROGRAM_VALUE='" + e.NewValues["PROGRAM_VALUE"].ToString() + "'";
        dataConn dcV = new dataConn(chSqlV);

        if (!ASPxGridView1.IsNewRowEditing)
        {
            if (dcV.GetState() == true && e.NewValues["PROGRAM_VALUE"].ToString() != e.OldValues["PROGRAM_VALUE"].ToString())
            {
                e.RowError = "链接地址输入重复,请重新输入!";
            }
        }
        if (ASPxGridView1.IsNewRowEditing)
        {
            if (dcV.GetState() == true)
            {
                e.RowError = "链接地址输入重复,请重新输入!";
            }
        }
    }
示例#9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PubCs  thePubCs      = new PubCs();
        string theServerPath = Server.MapPath("~/").ToString();

        theServerPath = theServerPath + "Rmes/Pub/Xml/RmesConfig.xml";
        baseURI       = thePubCs.ReadFromXml(theServerPath, "rootPath");


        userManager theUserManager = (userManager)Session["theUserManager"];

        theDisplayProgramName = theUserManager.getProgName();
        theDisplayPlineName   = theUserManager.getPlineName();
        theDisplayUserName    = theUserManager.getUserName();
        theDisplayCompanyCode = theUserManager.getCompanyCode();
        theDisplayProgramCode = theUserManager.getProgCode();

        string theMenuCompanyCode = theUserManager.getCompanyCode();
        string theMenuUserCode    = theUserManager.getUserCode();
        string theMenuUserId      = theUserManager.getUserId();

        string opt    = Request["opt"] as string;
        string progid = Request["progCode"] as string;

        if (opt != null && progid != null && opt != string.Empty && progid != string.Empty)
        {
            if (opt == "setdefaultpage")
            {
                try
                {
                    dataConn dc      = new dataConn();
                    string   _theSql = "SELECT * FROM REL_USER_DEFAULTPAGE WHERE COMPANY_CODE = '" + theDisplayCompanyCode + "' AND USER_ID = '" + theMenuUserId + "'";
                    dc.setTheSql(_theSql);
                    if (dc.GetState())
                    {
                        _theSql = "UPDATE REL_USER_DEFAULTPAGE SET DEFAULT_PAGE = '" + progid + "' WHERE  COMPANY_CODE = '" + theDisplayCompanyCode + "' AND USER_ID = '" + theMenuUserId + "'";
                    }
                    else
                    {
                        _theSql = "INSERT INTO REL_USER_DEFAULTPAGE(COMPANY_CODE,USER_ID,DEFAULT_PAGE)VALUES('" + theDisplayCompanyCode + "','" + theMenuUserId + "','" + progid + "')";
                    }
                    dc.ExeSql(_theSql);
                    Response.Write("设置成功:" + progid);
                }
                catch (Exception ex)
                {
                    Response.Write("设置失败,信息如下:\n" + ex.Message);
                }
                Response.End();
            }
        }

        //得到菜单绝对地址
        string theHost    = Request.ServerVariables["REMOTE_ADDR"];
        string thePort    = Request.ServerVariables["SERVER_PORT"];
        string theUrl     = Request.ServerVariables["URL"];
        string theUrlTemp = theUrl.Substring(0, theUrl.IndexOf("/", 1));

        string str = "欢迎使用RMES系统," + theDisplayPlineName + " 的 " + theDisplayUserName + ",你当前打开的页面:" + theDisplayProgramName;

        ASPxRoundPanel1.HeaderText = str;

        //帮助 20080408

        theHelpFile = theUrlTemp + "/Rmes/Help/" + theDisplayProgramCode + ".htm";


        //考虑以后可能对程序内容做一些处理,暂且定义变量
        //string theProgTemp = "";

        string   theSql      = "select menu_code,menu_name,menu_code_father,menu_index,program_code,program_name,program_value from vw_rel_user_menu where company_code='" + theMenuCompanyCode + "' and user_id='" + theMenuUserId + "' order by menu_level,menu_index";
        dataConn theDataConn = new dataConn(theSql);
        //theDataConn.OpenConn();
        //theDataConn.theComd.CommandType = CommandType.Text;
        //theDataConn.theComd.CommandText = theSql;
        //OracleDataReader dr = theDataConn.theComd.ExecuteReader();

        DataTable dt = theDataConn.GetTable(theSql);
        DataView  dv = new DataView(dt);

        dv.RowFilter = "menu_code_father is NULL and menu_code is not NUll and menu_name is not NULL";
        dv.Sort      = "menu_index";

        string name = "", text = "", url = "";

        foreach (DataRowView dvr in dv)
        {
            name = dvr["menu_code"].ToString();
            text = dvr["menu_name"].ToString();
            url  = dvr["program_value"].ToString().Trim();
            url  = url.Equals("") ? "" : ("../.." + url + "?progCode=" + dvr["program_code"].ToString() + "&progName=" + dvr["program_name"]);
            if (!text.Trim().Equals(""))
            {
                DevExpress.Web.ASPxMenu.MenuItem m = new DevExpress.Web.ASPxMenu.MenuItem(text, name, "", url);
                ASPxMenu1.Items.Add(m);
                AddChildMenu(dt, m);
            }
        }
        if (ASPxMenu1.Items.Count > 0)
        {
            //modeify by thl 20161011 用户不需要 注释了
            ASPxMenu1.Target = "ifmain";
            ASPxMenu1.Items.Add("附加功能", "ext_menu", "", "");
            DevExpress.Web.ASPxMenu.MenuItem m = ASPxMenu1.Items.FindByName("ext_menu");
            m.Items.Add("设置为默认页", "ext_set_homepage", "", "javascript:$.setDefaultPage(window.ifmain.location.href)", "_self");
            //m.Items.Add("选择主题", "ext_set_theme", "", "");
            DevExpress.Web.ASPxMenu.MenuItem n = ASPxMenu1.Items.FindByName("ext_set_theme");


            string path = Server.MapPath("~/App_Themes");

            //string[] themes = System.IO.Directory.GetDirectories(path);

            //string sTemp = "";
            //foreach (string s in themes)
            //{
            //    sTemp = s.Substring(s.LastIndexOf("\\") + 1);
            //    if (!sTemp.StartsWith("."))
            //        n.Items.Add(sTemp, sTemp, "", "javascript:jQuery.setTheme('" + sTemp + "')", "_self");
            //}
        }
    }
示例#10
0
    protected void ASPxGridView1_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
    {
        //判断超长
        if (e.NewValues["COMPANY_CODE"].ToString().Length > 30)
        {
            e.RowError = "公司代码字节长度不能超过30!";
        }
        if (e.NewValues["COMPANY_NAME"].ToString().Length > 30)
        {
            e.RowError = "公司名称字节长度不能超过30!";
        }
        if (e.NewValues["COMPANY_NAME_BRIEF"].ToString().Length > 30)
        {
            e.RowError = "公司简称字节长度不能超过30!";
        }
        if (e.NewValues["COMPANY_NAME_EN"].ToString().Length > 30)
        {
            e.RowError = "英文名称字节长度不能超过30!";
        }

        if (e.NewValues["COMPANY_WEBSITE"].ToString().Length > 30)
        {
            e.RowError = "公司网址字节长度不能超过30!";
        }

        if (e.NewValues["COMPANY_ADDRESS"].ToString().Length > 50)
        {
            e.RowError = "公司地址字节长度不能超过50!";
        }

        //判断为空
        if (e.NewValues["COMPANY_CODE"].ToString() == "" || e.NewValues["COMPANY_CODE"].ToString() == null)
        {
            e.RowError = "公司代码不能为空!";
        }
        if (e.NewValues["COMPANY_NAME"].ToString() == "" || e.NewValues["COMPANY_NAME"].ToString() == null)
        {
            e.RowError = "公司名称不能为空!";
        }
        if (e.NewValues["COMPANY_NAME_BRIEF"].ToString() == "" || e.NewValues["COMPANY_NAME_BRIEF"].ToString() == null)
        {
            e.RowError = "公司简称不能为空!";
        }
        if (e.NewValues["COMPANY_NAME_EN"].ToString() == "" || e.NewValues["COMPANY_NAME_EN"].ToString() == null)
        {
            e.RowError = "英文名称不能为空!";
        }

        if (e.NewValues["COMPANY_WEBSITE"].ToString() == "" || e.NewValues["COMPANY_WEBSITE"].ToString() == null)
        {
            e.RowError = "公司网址不能为空!";
        }



        //新增判断键值重复
        if (ASPxGridView1.IsNewRowEditing)
        {
            string chSql = "SELECT COMPANY_CODE, COMPANY_NAME, COMPANY_NAME_BRIEF, COMPANY_NAME_EN, COMPANY_WEBSITE, COMPANY_ADDRESS FROM CODE_COMPANY"
                           + " WHERE COMPANY_CODE = '" + e.NewValues["COMPANY_CODE"].ToString() + "'";
            dataConn dc = new dataConn(chSql);
            if (dc.GetState() == true)
            {
                e.RowError = "公司代码重复,请重新命名或分配!";
            }
        }
    }
示例#11
0
        protected void ASPxCbSubmit1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            int count = 0;

            string oFlag, pline, station, pSeries, detectCode;

            char[]   charSeparators = new char[] { ',' };
            string[] collection     = e.Parameter.Split(charSeparators);
            int      cnt            = collection.Length;

            oFlag   = collection[0].ToString();
            pline   = collection[1].ToString();
            station = collection[2].ToString();
            pSeries = collection[3].ToString();

            if (oFlag == "ADD")
            {
                //获取检测数据
                List <string> s = new List <string>();
                for (int i = 4; i < cnt; i++)
                {
                    s.Add(collection[i].ToString());
                }
                string[] s1 = s.ToArray();

                if (ASPxGridView3.Selection.Count == 0)
                {
                    e.Result = "Fail,请选择要增加的检测数据!";
                    return;
                }
                for (int i = 0; i < s1.Length; i++)
                {
                    detectCode = s1[i].ToString();

                    string detectName     = "";
                    string detectType     = "";
                    string detectStandard = "";
                    string detectMax      = "";
                    string detectMin      = "";
                    string detectUnit     = "";

                    string chSql = "select detect_name,detect_type,detect_standard,detect_max,detect_min,detect_unit from code_detect"
                                   + " where pline_code='" + pline + "' and detect_code='" + detectCode + "'";
                    dataConn  chDc = new dataConn(chSql);
                    DataTable chDt = chDc.GetTable();
                    if (chDt.Rows.Count > 0)
                    {
                        detectName     = chDt.Rows[0]["detect_name"].ToString();
                        detectType     = chDt.Rows[0]["detect_type"].ToString();
                        detectStandard = chDt.Rows[0]["detect_standard"].ToString();
                        detectMax      = chDt.Rows[0]["detect_max"].ToString();
                        detectMin      = chDt.Rows[0]["detect_min"].ToString();
                        detectUnit     = chDt.Rows[0]["detect_unit"].ToString();
                    }
                    //顺序号start
                    string   dSeq1 = "";
                    dataConn dc8   = new dataConn("select DETECT_SEQ from REL_STATION_DETECT_TEMP where pline_code ='" + pline + "' and PRODUCT_SERIES ='" + pSeries + "' and STATION_CODE ='" + station + "'");
                    if (dc8.GetState() == true)
                    {
                        string    cSql = "select max(DETECT_SEQ) DETECT_SEQ_MAX from REL_STATION_DETECT_TEMP where pline_code ='" + pline + "' and PRODUCT_SERIES ='" + pSeries + "' and STATION_CODE ='" + station + "'";
                        dataConn  dc1  = new dataConn(cSql);
                        DataTable dt   = dc1.GetTable();
                        string    aa   = dt.Rows[0]["DETECT_SEQ_MAX"].ToString();
                        dSeq1 = Convert.ToString(Convert.ToInt32(aa) + 1);
                    }
                    else
                    {
                        dSeq1 = "1";
                    }
                    //顺序号end

                    string inSqlTemp = "insert into REL_STATION_DETECT_TEMP(RMES_ID,PLINE_CODE,STATION_CODE,PRODUCT_SERIES,DETECT_CODE,DETECT_NAME,DETECT_TYPE,"
                                       + "DETECT_STANDARD,DETECT_MAX,DETECT_MIN,DETECT_UNIT,DETECT_SEQ,MACHINENAME,INSERT_FLAG) "
                                       + "values(SEQ_RMES_ID.NEXTVAL,'" + pline + "','" + station + "','" + pSeries + "','" + detectCode + "','" + detectName + "','" + detectType + "',"
                                       + "'" + detectStandard + "','" + detectMax + "','" + detectMin + "','" + detectUnit + "','" + dSeq1 + "',"
                                       + "'" + GV_MachineName + "','3')";
                    dc.ExeSql(inSqlTemp);
                }
                e.Result = "OK,增加成功!";
                return;
            }
            if (oFlag == "DELETE")
            {
                //获取工位
                List <string> s = new List <string>();
                for (int i = 4; i < cnt; i++)
                {
                    s.Add(collection[i].ToString());
                }
                string[] s1 = s.ToArray();

                if (ASPxGridView2.Selection.Count == 0)
                {
                    e.Result = "Fail,请选择要删除的检测数据!";
                    return;
                }
                for (int i = 0; i < s1.Length; i++)
                {
                    detectCode = s1[i].ToString();
                    string sql = "select insert_flag from REL_STATION_DETECT_TEMP where PLINE_CODE='" + pline + "' "
                                 + " AND STATION_CODE='" + station + "' and PRODUCT_SERIES ='" + pSeries + "' "
                                 + " AND MACHINENAME='" + GV_MachineName + "' and detect_code='" + detectCode + "' ";
                    dataConn  dc1 = new dataConn(sql);
                    DataTable dt1 = dc1.GetTable();

                    if (dt1.Rows[0]["insert_flag"].ToString() == "1")
                    {
                        string upSql = "update REL_STATION_DETECT_TEMP set insert_flag='2' where PLINE_CODE='" + pline + "'  "
                                       + "AND STATION_CODE='" + station + "' and PRODUCT_SERIES ='" + pSeries + "' "
                                       + " AND MACHINENAME='" + GV_MachineName + "' and detect_code='" + detectCode + "' ";
                        dc.ExeSql(upSql);
                    }
                    if (dt1.Rows[0]["insert_flag"].ToString() == "3")
                    {
                        string deSqlTemp = "DELETE FROM  REL_STATION_DETECT_TEMP WHERE PLINE_CODE='" + pline + "' and PRODUCT_SERIES ='" + pSeries + "' "
                                           + " AND STATION_CODE='" + station + "' AND MACHINENAME='" + GV_MachineName + "' and detect_code='" + detectCode + "'";
                        dc.ExeSql(deSqlTemp);
                    }
                }
                e.Result = "OK,删除成功!";
                return;
            }
            if (collection[0] == "SURE")
            {
                string    tempSql = "select RMES_ID,detect_code from REL_STATION_DETECT_TEMP";
                dataConn  tempDc  = new dataConn(tempSql);
                DataTable tempDt  = tempDc.GetTable();

                for (count = 0; count < tempDt.Rows.Count; count++)
                {
                    string rmesID = tempDt.Rows[count]["RMES_ID"].ToString();
                    detectCode = tempDt.Rows[count]["detect_code"].ToString();

                    string    sql = "select insert_flag from REL_STATION_DETECT_TEMP where rmes_id='" + rmesID + "'";
                    dataConn  dc1 = new dataConn(sql);
                    DataTable dt1 = dc1.GetTable();

                    if (dt1.Rows[0]["insert_flag"].ToString() == "2")
                    {
                        //插入到日志表
                        try
                        {
                            string Sql2 = "INSERT INTO REL_STATION_DETECT_LOG (rmes_id,company_code,pline_code,station_code,product_series,detect_code,detect_name,detect_type,detect_standard,"
                                          + "detect_max,detect_min,detect_unit,DETECT_SEQ,TEMP01,TEMP02,TEMP03,user_code,flag,rqsj)"
                                          + " SELECT rmes_id,company_code,pline_code,station_code,product_series,detect_code,detect_name,detect_type,detect_standard,"
                                          + "detect_max,detect_min,detect_unit,DETECT_SEQ,TEMP01,TEMP02,TEMP03,'"
                                          + theUserCode + "' , 'DEL', SYSDATE FROM REL_STATION_DETECT WHERE  rmes_id =  '"
                                          + rmesID + "' ";
                            dc.ExeSql(Sql2);
                        }
                        catch
                        {
                            return;
                        }

                        string dSql = "delete from REL_STATION_DETECT where rmes_id='" + rmesID + "'";
                        dc.ExeSql(dSql);
                    }
                    if (dt1.Rows[0]["insert_flag"].ToString() == "3")
                    {
                        string inSql = "insert into REL_STATION_DETECT(RMES_ID,COMPANY_CODE,PLINE_CODE,STATION_CODE,PRODUCT_SERIES,DETECT_CODE,DETECT_NAME,DETECT_TYPE,"
                                       + "DETECT_STANDARD,DETECT_MAX,DETECT_MIN,DETECT_UNIT,DETECT_SEQ,input_person,input_time) "
                                       + "select RMES_ID,'" + theCompanyCode + "',PLINE_CODE,STATION_CODE,PRODUCT_SERIES,DETECT_CODE,DETECT_NAME,DETECT_TYPE,"
                                       + "DETECT_STANDARD,DETECT_MAX,DETECT_MIN,DETECT_UNIT,DETECT_SEQ,'" + theUserId + "',sysdate from REL_STATION_DETECT_TEMP "
                                       + "where RMES_ID='" + rmesID + "'";
                        dc.ExeSql(inSql);
                        //插入到日志表
                        try
                        {
                            string Sql2 = "INSERT INTO REL_STATION_DETECT_LOG (rmes_id,company_code,pline_code,station_code,product_series,detect_code,detect_name,detect_type,detect_standard,"
                                          + "detect_max,detect_min,detect_unit,DETECT_SEQ,TEMP01,TEMP02,TEMP03,user_code,flag,rqsj)"
                                          + " SELECT rmes_id,company_code,pline_code,station_code,product_series,detect_code,detect_name,detect_type,detect_standard,"
                                          + "detect_max,detect_min,detect_unit,DETECT_SEQ,TEMP01,TEMP02,TEMP03,'"
                                          + theUserCode + "' , 'ADD', SYSDATE FROM REL_STATION_DETECT WHERE  rmes_id =  '"
                                          + rmesID + "' ";
                            dc.ExeSql(Sql2);
                        }
                        catch
                        {
                            return;
                        }
                    }
                }
                string sqlD = "DELETE from REL_STATION_DETECT_TEMP";
                dc.ExeSql(sqlD);

                e.Result = "Sure,确认成功!";
                return;
            }
        }
示例#12
0
        protected void ASPxCbSubmit_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            int count = 0;

            string pline, station, pSeries, detectCode;

            //e.Result = "fail,";
            char[]   charSeparators = new char[] { ',' };
            string[] collection     = e.Parameter.Split(charSeparators);
            int      cnt            = collection.Length;

            pline   = collection[0].ToString();
            station = collection[1].ToString();
            pSeries = collection[cnt - 1].ToString();

            for (count = 0; count < listChosedDetect.Items.Count; count++)
            {
                detectCode = listChosedDetect.Items[count].ToString();
                string[] sArray = detectCode.Split(';');

                string    detectName     = "";
                string    detectType     = "";
                string    detectStandard = "";
                string    detectMax      = "";
                string    detectMin      = "";
                string    detectUnit     = "";
                string    chSql          = "select detect_name,detect_type,detect_standard,detect_max,detect_min,detect_unit from code_detect where pline_code='" + pline + "' and detect_code='" + sArray[0] + "'";
                dataConn  chDc           = new dataConn(chSql);
                DataTable chDt           = chDc.GetTable();
                if (chDt.Rows.Count > 0)
                {
                    detectName     = chDt.Rows[0]["detect_name"].ToString();
                    detectType     = chDt.Rows[0]["detect_type"].ToString();
                    detectStandard = chDt.Rows[0]["detect_standard"].ToString();
                    detectMax      = chDt.Rows[0]["detect_max"].ToString();
                    detectMin      = chDt.Rows[0]["detect_min"].ToString();
                    detectUnit     = chDt.Rows[0]["detect_unit"].ToString();
                }
                //顺序号start
                string   detectCode1 = "";
                dataConn dc8         = new dataConn("select DETECT_SEQ from REL_STATION_DETECT where pline_code ='" + pline + "' and PRODUCT_SERIES ='" + pSeries + "' and STATION_CODE ='" + station + "'");
                if (dc8.GetState() == true)
                {
                    string    cSql = "select max(DETECT_SEQ) DETECT_SEQ_MAX from REL_STATION_DETECT where pline_code ='" + pline + "' and PRODUCT_SERIES ='" + pSeries + "' and STATION_CODE ='" + station + "'";
                    dataConn  dc1  = new dataConn(cSql);
                    DataTable dt   = dc1.GetTable();
                    string    aa   = dt.Rows[0]["DETECT_SEQ_MAX"].ToString();
                    detectCode1 = Convert.ToString(Convert.ToInt32(aa) + 1);
                }
                else
                {
                    detectCode1 = "1";
                }
                //顺序号end

                string sql = "insert into REL_STATION_DETECT(rmes_id,company_code,pline_code,station_code,product_series,detect_code,detect_name,detect_type,detect_standard,"
                             + "detect_max,detect_min,detect_unit,DETECT_SEQ)"
                             + "values(SEQ_RMES_ID.NEXTVAL,'" + theCompanyCode + "','" + pline + "','" + station + "','" + pSeries + "','" + sArray[0] + "','" + detectName + "',"
                             + "'" + detectType + "','" + detectStandard + "','" + detectMax + "','" + detectMin + "','" + detectUnit + "','" + detectCode1 + "')";
                dc.ExeSql(sql);
            }
        }