コード例 #1
0
        protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            //多选删除,判断是否可以删除
            ASPxGridView  atl1   = (ASPxGridView)sender;
            int           count1 = atl1.Selection.Count;
            List <object> aa     = atl1.GetSelectedFieldValues("RMES_ID");
            List <object> flag1  = atl1.GetSelectedFieldValues("CONFIRM_FLAG");
            List <object> flag2  = atl1.GetSelectedFieldValues("RUN_FLAG");
            List <object> flag3  = atl1.GetSelectedFieldValues("ITEM_FLAG");
            List <object> flag4  = atl1.GetSelectedFieldValues("THIRD_FLAG");

            List <object> plancode1     = atl1.GetSelectedFieldValues("PLAN_CODE");
            List <object> planso1       = atl1.GetSelectedFieldValues("PLAN_SO");
            List <object> plinecode1    = atl1.GetSelectedFieldValues("PLINE_CODE");
            List <object> planseq1      = atl1.GetSelectedFieldValues("PLAN_SEQ");
            List <object> rountingsite1 = atl1.GetSelectedFieldValues("ROUNTING_SITE");
            List <object> planqty1      = atl1.GetSelectedFieldValues("PLAN_QTY");

            for (int i = 0; i < aa.Count; i++)
            {
                try
                {
                    if (flag1[i].ToString() == "N" && flag2[i].ToString() == "N" && flag3[i].ToString() == "N" && flag4[i].ToString() == "N")
                    {
                        string plancode  = plancode1[i].ToString();
                        string planso    = planso1[i].ToString();
                        string PlineCode = plinecode1[i].ToString();
                        string Planseq   = planseq1[i].ToString();
                        string Rsite     = rountingsite1[i].ToString();
                        string qty       = planqty1[i].ToString();

                        //string plancode = e.Values["PLAN_CODE"].ToString();
                        //string planso = e.Values["PLAN_SO"].ToString();
                        //string PlineCode = e.Values["PLINE_CODE"].ToString();
                        //string Planseq = e.Values["PLAN_SEQ"].ToString();
                        //string Rsite = e.Values["ROUNTING_SITE"].ToString();
                        //string qty = e.Values["PLAN_QTY"].ToString();
                        userManager theUserManager = (userManager)Session["theUserManager"];

                        //PlanFactory.PL_CREATE_PLAN("DELETE", theCompanyCode, PlineCode, "", "", plancode, planso, "", "B", "", "", "", "", "", "", "0", "0", "", "", "", "", "", "Y");
                        PlanFactory.PL_CREATE_PLAN("DELETE", theCompanyCode, PlineCode, "", Planseq, plancode, planso, "", "B", theUserId, theUserManager.getUserName(), "", "", "", qty, "0", "0", Rsite, "", "", "", "", "Y");
                    }
                }
                catch
                { }
            }
            e.Cancel = true;
            setCondition();
        }
コード例 #2
0
        protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxTextBox  rmesid     = ASPxGridView1.FindEditFormTemplateControl("txtRmesid") as ASPxTextBox;
            ASPxTextBox  plancode   = ASPxGridView1.FindEditFormTemplateControl("txtPlanCode") as ASPxTextBox;
            ASPxTextBox  planseq    = ASPxGridView1.FindEditFormTemplateControl("txtPlanSeq") as ASPxTextBox;
            ASPxTextBox  planso     = ASPxGridView1.FindEditFormTemplateControl("txtPlanSO") as ASPxTextBox;
            ASPxTextBox  planseries = ASPxGridView1.FindEditFormTemplateControl("productSeries") as ASPxTextBox;
            ASPxTextBox  qty        = ASPxGridView1.FindEditFormTemplateControl("ASPxplanqty") as ASPxTextBox;
            ASPxTextBox  customer   = ASPxGridView1.FindEditFormTemplateControl("ASPxCustomer") as ASPxTextBox;
            ASPxComboBox across     = ASPxGridView1.FindEditFormTemplateControl("ASPxComboBoxAcross1") as ASPxComboBox;
            ASPxMemo     remark     = ASPxGridView1.FindEditFormTemplateControl("txtRemark") as ASPxMemo;
            ASPxComboBox PlineCode  = ASPxGridView1.FindEditFormTemplateControl("PlineCombo") as ASPxComboBox;
            ASPxComboBox RSite      = ASPxGridView1.FindEditFormTemplateControl("RountingsiteCombo") as ASPxComboBox;
            ASPxDateEdit begindate1 = ASPxGridView1.FindEditFormTemplateControl("ASPxDateBegin") as ASPxDateEdit;
            ASPxDateEdit enddate1   = ASPxGridView1.FindEditFormTemplateControl("ASPxDateEnd") as ASPxDateEdit;

            DateTime beginDate = begindate1.Date;
            DateTime endDate   = enddate1.Date;

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

            string gylx1;
            string accountdate1;
            string ROUNTING_CODE1 = across.Value.ToString(); //工艺路线代码,默认为
            //调用函数判断计划代码是否符合规范
            string sqlPlan = "select func_check_plan('B','" + plancode.Text.Trim() + "','" + PlineCode.SelectedItem.Value + "','" + RSite.SelectedItem.Value + "','" + planso.Text.Trim() + "') from dual";

            dc.setTheSql(sqlPlan);
            string getvalue1 = dc.GetValue();

            char[]   charSeparators1 = new char[] { '#' };
            string[] collection1     = getvalue1.Split(charSeparators1);

            if (collection1[0] != "OK")
            {
                return;
            }
            else
            {
                accountdate1 = collection1[1];
                gylx1        = collection1[2];
            }

            PlanFactory.PL_CREATE_PLAN("MODIFY", theCompanyCode, PlineCode.SelectedItem.Value.ToString(), PlineCode.SelectedItem.Text, planseq.Text.Trim(), plancode.Text.Trim(), planso.Text.Trim(), planseries.Text.Trim(), "B", theUserId, theUserManager.getUserName(), beginDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"), accountdate1, qty.Text.Trim(), "0", "0", RSite.SelectedItem.Value.ToString(), gylx1, customer.Text.Trim(), remark.Text.Trim(), ROUNTING_CODE1, "Y");

            e.Cancel = true;
            ASPxGridView1.CancelEdit();
            setCondition();
        }
コード例 #3
0
        protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string plancode = e.Values["PLAN_CODE"].ToString();
            string planso = e.Values["PLAN_SO"].ToString();
            string PlineCode = e.Values["PLINE_CODE"].ToString();
            string Planseq = e.Values["PLAN_SEQ"].ToString();
            string Rsite = e.Values["ROUNTING_SITE"].ToString();
            string qty = e.Values["PLAN_QTY"].ToString();
            userManager theUserManager = (userManager)Session["theUserManager"];

            string sql = "select count(1) from data_plan_sn where plan_code='" + plancode + "'";
            dc.setTheSql(sql);
            if (dc.GetValue().ToString() != "0")
            {
                ASPxGridView1.JSProperties.Add("cpCallbackName", "Delete");
                ASPxGridView1.JSProperties.Add("cpCallbackRet", "该计划还有未删除的条码!");
            }
            else
            {
                PlanFactory.PL_CREATE_PLAN("DELETE", theCompanyCode, PlineCode, "", Planseq, plancode, planso, "", "E", theUserId, theUserManager.getUserName(), "", "", "", qty, "0", "0", Rsite, "", "", "", "", "Y");
            }
            e.Cancel = true;
            setCondition();
        }
コード例 #4
0
        protected void ASPxButton_Import_Click(object sender, EventArgs e)
        {
            try
            {
                ASPxButton_Import.Enabled = false;

                string path = File1.Value;//上传文件路径

                if (path == "")
                {
                    ASPxButton_Import.Enabled = true;
                    return;
                }

                string uploadPath = Server.MapPath(Request.ApplicationPath); //上传目录及文件名
                string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + "G.xls";


                uploadPath = uploadPath + "\\Rmes\\File\\excel\\" + fileName; //得到上传目录及文件名称  
                File1.PostedFile.SaveAs(uploadPath);       //上传文件到服务器  

                DataTable dt = GetExcelDataTable(uploadPath);

                int count = 0;
                foreach (DataRow t in dt.Rows)
                {
                    if (t.IsNull(0)) continue;
                    string planCode = t[0].ToString().Trim();
                    string planSo = t[1].ToString().Trim();
                    string planQty = t[2].ToString().Trim();
                    string planCus = t[3].ToString().Trim();
                    string pline = t[4].ToString().Trim();
                    string rountingsite = t[5].ToString().Trim();
                    string remark = t[6].ToString().Trim();

                    //调用函数判断计划代码是否符合规范
                    string sqlPlan = "select func_check_plan('E','" + planCode + "','" + pline + "','" + rountingsite + "','" + planSo + "') from dual";
                    dc.setTheSql(sqlPlan);
                    string getvalue1 = dc.GetValue();
                    char[] charSeparators1 = new char[] { '#' };
                    string[] collection1 = getvalue1.Split(charSeparators1);

                    if (collection1[0] != "OK")
                    {
                        Show(this, planCode + ":" + collection1[1]);
                        //ASPxCallbackPanel6.JSProperties.Add("cpCallbackName", "Fail");
                        //ASPxCallbackPanel6.JSProperties.Add("cpCallbackRet", collection1[1]);
                        ASPxButton_Import.Enabled = true;
                        return;
                    }
                }
                foreach (DataRow t in dt.Rows)
                {
                    try
                    {
                        string planCode = t[0].ToString().Trim();
                        string planSo = t[1].ToString().Trim();
                        string planQty = t[2].ToString().Trim();
                        string planCus = t[3].ToString().Trim();
                        string pline = t[4].ToString().Trim();
                        string rountingsite = t[5].ToString().Trim();
                        string remark = t[6].ToString().Trim();
                        string accountdate1;
                        string gylx1;
                        string ROUNTING_CODE1 = "A01";
                        string plineName = "", seq = "", series = "";
                        string plantype = "E";
                        string IsBom = "Y";
                        //调用函数判断计划代码是否符合规范
                        string sqlPlan = "select func_check_plan('E','" + planCode + "','" + pline + "','" + rountingsite + "','" + planSo + "') from dual";
                        dc.setTheSql(sqlPlan);
                        string getvalue1 = dc.GetValue();
                        char[] charSeparators1 = new char[] { '#' };
                        string[] collection1 = getvalue1.Split(charSeparators1);

                        if (collection1[0] != "OK")
                        {
                            Show(this, planCode + ":" + collection1[1]);
                            //ASPxCallbackPanel6.JSProperties.Add("cpCallbackName", "Fail");
                            //ASPxCallbackPanel6.JSProperties.Add("cpCallbackRet", collection1[1]);
                            ASPxButton_Import.Enabled = true;
                            return;
                        }
                        else
                        {
                            accountdate1 = collection1[1];
                            gylx1 = collection1[2];
                        }
                        string sql = "select pline_name from code_product_line where pline_code='" + pline + "'";
                        dc.setTheSql(sql);
                        plineName = dc.GetValue();

                        sql = "select nvl(max(plan_seq+1),'1') from data_plan where pline_code='" + pline + "' and plan_type='" + plantype + "' and begin_date=to_date('" + ASPxDateEdit1.Date.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') ";
                        dc.setTheSql(sql);
                        seq = dc.GetValue();

                        sql = "select jx from copy_engine_property where SO='" + planSo + "' and rownum=1";
                        dc.setTheSql(sql);
                        series = dc.GetTable().Rows[0][0].ToString();
                        if (series.EndsWith("ZZ"))
                        {
                            series = series.Substring(0, series.Length - 2);
                        }

                        userManager theUserManager = (userManager)Session["theUserManager"];
                        try
                        {
                            PlanFactory.PL_CREATE_PLAN("ADD", theCompanyCode, pline, plineName, seq, planCode, planSo, series, plantype, theUserId, theUserManager.getUserName(), ASPxDateEdit1.Date.ToString("yyyy-MM-dd"), ASPxDateEdit1.Date.ToString("yyyy-MM-dd"), accountdate1, planQty, "0", "0", rountingsite, gylx1, planCus, remark, ROUNTING_CODE1, IsBom);
                            //ASPxButton_Import.Enabled = true;
                            //return;
                        }
                        catch (Exception ex)
                        {
                            Show(this, ex.Message);
                            //ASPxCallbackPanel6.JSProperties.Add("cpCallbackName", "Fail");
                            //ASPxCallbackPanel6.JSProperties.Add("cpCallbackRet", ex.Message);
                            ASPxButton_Import.Enabled = true;
                            return;
                        }
                    }
                    catch (Exception ex1)
                    {
                        Show(this, ex1.Message);
                        //ASPxCallbackPanel6.JSProperties.Add("cpCallbackName", "Fail");
                        //ASPxCallbackPanel6.JSProperties.Add("cpCallbackRet", ex1.Message);
                        ASPxButton_Import.Enabled = true;
                        return;
                    }
                    //count += 1;
                }

                ASPxButton_Import.Enabled = true;
                setCondition();
                return;
            }
            catch (Exception ex2)
            {
                ASPxCallbackPanel6.JSProperties.Add("cpCallbackName", "Fail");
                ASPxCallbackPanel6.JSProperties.Add("cpCallbackRet", ex2.Message);
                ASPxButton_Import.Enabled = true;
            }
        }
コード例 #5
0
        //最终提交生成计划及计划关联BOM清单
        protected void ASPxCbSubmit_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            char[] charSeparators = new char[] { ',' };
            string[] collection = e.Parameter.Split(charSeparators);
            int cnt = collection.Length;
            {
                DateTime beginDate = ASPxBeginDate.Date;
                DateTime endDate = ASPxEndDate.Date;
                string pline = ASPxComboBoxPline.SelectedItem.Value.ToString();
                string rountingsite = ASPxComboBoxProcess.SelectedItem.Value.ToString();
                string plineName = ASPxComboBoxPline.SelectedItem.Text;
                string process = ASPxComboBoxProcess.SelectedItem.Value.ToString();
                string cjzd = CJZD.SelectedItem.Value.ToString();
                string series = ASPxTextSeries.Text;
                string so = ASPxTextBoxSO.Text;
                string planCode = ASPxTextPlanCode.Text;
                string seq = ASPxTextBoxSeq.Text;
                string remark = ASPxTextBoxRemark.Text;
                string customerName = ASPxTextBoxCustomerName.Text;
                string qty = ASPxTextBoxQty.Text;
                string gylx1;
                string accountdate1;
                string ROUNTING_CODE1 = "A01"; //工艺路线代码,默认为A01
                //string plantype = ASPxComboBoxPlanType.SelectedItem.Value.ToString();
                string plantype = "E";
                string IsBOm = "";
                IsBOm = "Y";
                //调用函数判断计划代码是否符合规范
                string sqlPlan = "select func_check_plan('E','" + planCode + "','" + pline + "','" + rountingsite + "','" + so + "') from dual";
                dc.setTheSql(sqlPlan);
                string getvalue1 = dc.GetValue();
                char[] charSeparators1 = new char[] { '#' };
                string[] collection1 = getvalue1.Split(charSeparators1);

                if (collection1[0] != "OK")
                {
                    e.Result = "Fail," + collection1[1];
                    return;
                }
                else
                {
                    accountdate1 = collection1[1];
                    gylx1 = collection1[2];
                }
                userManager theUserManager = (userManager)Session["theUserManager"];
                try
                {
                    PlanFactory.PL_CREATE_PLAN("ADD", theCompanyCode, pline, plineName, seq, planCode, so, series, plantype, theUserId, theUserManager.getUserName(), beginDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"), accountdate1, qty, "0", "0", rountingsite, gylx1, customerName, remark, ROUNTING_CODE1, IsBOm);
                    //dc.ExeSql("call PL_CREATE_PLAN('ADD','" + theCompanyCode + "','" + pline + "','" + plineName + "','" + seq + "','" + planCode + "','" + so + "','" + series + "','A','" + theUserId + "','" + theUserManager.getUserName() + "',to_date('" + beginDate.ToString("yyyy-MM-dd") + "','yyyy-MM-dd'),to_date('" + endDate.ToString("yyyy-MM-dd") + "','yyyy-MM-dd')),to_date('" + accountdate1 + "','yyyy-MM-dd')),'" + qty + "','0','0','" + rountingsite + "','" + gylx1 + "','" + customerName + "','" + remark + "','" + ROUNTING_CODE1 + "'");
                    string sql = "delete from ATPUPLAN_CJSTATION where jhdm='"+planCode+"'";
                    dc.ExeSql(sql);
                    sql = "insert into ATPUPLAN_CJSTATION(jhdm,cjzd) values('"+planCode+"','"+CJZD+"')";
                    dc.ExeSql(sql);
                    e.Result = "OK,计划提交成功!";
                    return;
                }
                catch (Exception ex)
                {
                    e.Result = "Fail,计划生成失败!";
                    return;
                }
            }
        }
コード例 #6
0
        //最终提交生成计划及计划关联BOM清单
        protected void ASPxCbSubmit_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            string[] collection = e.Parameter.Split('|');
            int      cnt        = collection.Length;

            if (collection[0] == "Commit")
            {
                //自动分配流水号
                //获取计划,判断计划类型
                string   value     = collection[1];
                string   value1    = collection[2];
                string[] _ids      = value1.Split(',');//rmes_id
                DateTime beginDate = ASPxBeginDate.Date;
                DateTime endDate   = ASPxEndDate.Date;

                int count2 = 0;
                for (int k = 0; k < _ids.Length; k++)
                {
                    string sn1           = _ids[k].ToString();
                    string pline1        = "L";
                    string rountingsite1 = "L";
                    string planCode1     = "LQ" + beginDate.ToString("yyyyMMdd");
                    //调用函数判断计划代码是否符合规范
                    string sqlPlan = "select func_check_plan('C','" + planCode1 + "','" + pline1 + "','" + rountingsite1 + "','" + sn1 + "') from dual";
                    dc.setTheSql(sqlPlan);
                    string   getvalue1       = dc.GetValue();
                    char[]   charSeparators1 = new char[] { '#' };
                    string[] collection1     = getvalue1.Split(charSeparators1);

                    if (collection1[0] != "OK")
                    {
                        e.Result = "Fail," + sn1 + collection1[1];
                        return;
                    }
                }
                for (int i = 0; i < _ids.Length; i++)
                {
                    string sn           = _ids[i].ToString();
                    string pline        = "L";
                    string rountingsite = "L";
                    string plineName    = "柳汽";
                    string series       = "";
                    string so           = "";
                    string planCode     = "LQ" + beginDate.ToString("yyyyMMdd");
                    string planOldCode  = "";
                    string seq          = "";
                    string remark       = "CKD";
                    string customerName = "柳汽";
                    string qty          = "1";
                    string gylx1;
                    string accountdate1;
                    string ROUNTING_CODE1 = ""; //工艺路线代码,默认为
                    //调用函数判断计划代码是否符合规范
                    string sqlPlan = "select func_check_plan('C','" + planCode + "','" + pline + "','" + rountingsite + "','" + sn + "') from dual";
                    dc.setTheSql(sqlPlan);
                    string   getvalue1       = dc.GetValue();
                    char[]   charSeparators1 = new char[] { '#' };
                    string[] collection1     = getvalue1.Split(charSeparators1);

                    if (collection1[0] != "OK")
                    {
                        e.Result = "Fail," + collection1[1];
                        return;
                    }
                    else
                    {
                        planCode    = collection1[1];
                        gylx1       = collection1[2];
                        so          = collection1[3];
                        series      = collection1[5];
                        seq         = collection1[4];
                        planOldCode = collection1[6];
                    }
                    userManager theUserManager = (userManager)Session["theUserManager"];
                    try
                    {
                        PlanFactory.PL_CREATE_PLAN("ADD", theCompanyCode, pline, plineName, seq, planCode, so, series, "B", theUserId, theUserManager.getUserName(), beginDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"), beginDate.ToString("yyyy-MM-dd"), qty, "0", "0", rountingsite, gylx1, customerName, remark, ROUNTING_CODE1, "Y");

                        string sql = "insert into atpujhsn(jhmc,ghtm,jhmcold) values ('" + planCode + "','" + sn + "','" + planOldCode + "' )";
                        dc.ExeSql(sql);
                        dc.ExeSql("update data_plan_sn set is_valid='N' where sn='" + sn + "' ");//and pline_code='" + pline + "'
                        sql = "insert into DATA_PLAN_SN(rmes_id,company_code,pline_code,plan_code,sn,sn_flag,create_time) values( SEQ_RMES_ID.Nextval,'{0}','{1}','{2}','{3}','N',sysdate )";
                        sql = string.Format(sql, theCompanyCode, pline, planCode, sn);
                        dc.ExeSql(sql);

                        sql = "update data_plan set sn_flag='Y' where plan_code='" + planCode + "'";
                        dc.ExeSql(sql);
                    }
                    catch (Exception ex)
                    {
                        e.Result = "Fail,计划生成失败!";
                        return;
                    }
                }
                e.Result = "OK,计划提交成功!";
                return;
            }
        }