Ejemplo n.º 1
0
        public void DuplicatePlanEventsTest()
        {
            AddDuplicatePlanEvents(DateTime.Now.AddDays(-1), DateTime.Now, "1001", _db);
            var plans = PlanFactory.GetBasicPlans(DateTime.Now.AddDays(-1), DateTime.Now, "1001");

            Assert.IsTrue(plans.Count == 13);

            bool adjDupPlans = false;

            for (int i = 0; i > plans.Count; i++)
            {
                if (plans[i].PlanNumber == plans[i + i].PlanNumber)
                {
                    adjDupPlans = true;
                }
            }

            Assert.IsFalse(adjDupPlans);
        }
Ejemplo n.º 2
0
        public void BindData()
        {
            string _b = cdate1.Date.ToString("yyyyMMdd") + "000000";
            string _e = cdate2.Date.ToString("yyyyMMdd") + "235959";
            List <IMESLine2LineEntity> entity = db.Fetch <IMESLine2LineEntity>("where SERIAL between @0 and @1 order by AUFNR", _b, _e);

            string planSO    = txtPlanSO.Text;
            string orderCode = "";

            if (!string.IsNullOrEmpty(planSO))
            {
                List <PlanEntity> plan = PlanFactory.GetByPlanSO(planSO);


                if (plan != null && plan.Count > 0)
                {
                    orderCode = plan[0].ORDER_CODE;
                }

                if (!string.IsNullOrEmpty(orderCode))
                {
                    entity = (from s in entity where s.AUFNR == orderCode select s).ToList <IMESLine2LineEntity>();
                }
            }

            ASPxGridView1.DataSource = entity;

            DataTable dt = new DataTable();

            dt.Columns.Add("Text");
            dt.Columns.Add("Value");
            dt.Rows.Add("初始状态", "0");
            dt.Rows.Add("传送中", "1");
            dt.Rows.Add("已传送", "2");

            GridViewDataComboBoxColumn colPrind = ASPxGridView1.Columns["PRIND"] as GridViewDataComboBoxColumn;

            colPrind.PropertiesComboBox.DataSource = dt;
            colPrind.PropertiesComboBox.TextField  = "Text";
            colPrind.PropertiesComboBox.ValueField = "Value";

            ASPxGridView1.DataBind();
        }
Ejemplo n.º 3
0
        public void BindData()
        {
            string planSO    = txtPlanSO.Text;
            string plineCode = ComPline.SelectedItem.Value.ToString();
            //if (string.IsNullOrWhiteSpace(orderCode)) return;
            List <PlanEntity> plans = PlanFactory.GetByCreatePeriod(cdate1.Date, cdate2.Date);
            //string _b = cdate1.Date.ToString("yyyyMMdd") + "000000";
            //string _e = cdate2.Date.ToString("yyyyMMdd") + "235959";
            //List<IMESPlanBOMEntity> entity = db.Fetch<IMESPlanBOMEntity>("where SERIAL between @0 and @1 order by AUFNR", _b, _e);
            string _b = "B" + cdate1.Date.ToString("yyyyMMdd") + "0000";
            string _e = "B" + cdate2.Date.ToString("yyyyMMdd") + "9999";
            List <IMESPlanBOMEntity> entity = db.Fetch <IMESPlanBOMEntity>("where BATCH between @0 and @1 order by AUFNR", _b, _e);



            if (!string.IsNullOrWhiteSpace(planSO))
            {
                entity = (from s in entity where s.MATNR == planSO select s).ToList <IMESPlanBOMEntity>();
            }
            if (!ComPline.SelectedItem.Value.ToString().Equals("All"))
            {
                entity = (from s in entity where (from pl in plans where pl.PLINE_CODE == plineCode && pl.RUN_FLAG == "F" select pl.ORDER_CODE).Contains(s.AUFNR) select s).ToList <IMESPlanBOMEntity>();
            }

            ASPxGridView1.DataSource = entity;

            DataTable dt = new DataTable();

            dt.Columns.Add("Text");
            dt.Columns.Add("Value");
            dt.Rows.Add("初始状态", "0");
            dt.Rows.Add("传送中", "1");
            dt.Rows.Add("已传送", "2");

            GridViewDataComboBoxColumn colPrind = ASPxGridView1.Columns["PRIND"] as GridViewDataComboBoxColumn;

            colPrind.PropertiesComboBox.DataSource = dt;
            colPrind.PropertiesComboBox.TextField  = "Text";
            colPrind.PropertiesComboBox.ValueField = "Value";

            ASPxGridView1.DataBind();
        }
Ejemplo n.º 4
0
 public override void Execute()
 {
     try
     {
         _plan = PlanFactory.CreatePlan(GetPlanType(), ExecuteDate, NameFormatter, _args);
         if (!ChooseName())
         {
             return;
         }
         _plan.Name    = Name;
         _plan.Details = Details;
         IPlanManager _planManager = ManagerFactory.GetPlanManager(_plan);
         _planManager.CreatePlan(_plan);
         AddMessage("Save successed!", MessageType.Success);
     }
     catch (Exception ex)
     {
         AddMessage(ex.Message, MessageType.Error);
     }
 }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      theCompanyCode = theUserManager.getCompanyCode();
            string      theUserID      = theUserManager.getUserId();

            if (!IsPostBack)
            {
                List <LineSideStoreEntity> stores     = LinesideStoreFactory.GetAll();
                List <PlanEntity>          dataSource = PlanFactory.GetByUserID(theUserID);
                PlanCode.DataSource = dataSource;
                PlanCode.ValueField = "ORDER_CODE";
                PlanCode.TextField  = "ORDER_CODE";
                PlanCode.DataBind();
                DestinationStore.DataSource = stores;
                DestinationStore.ValueField = "STORE_CODE";
                DestinationStore.TextField  = "STORE_NAME";
                DestinationStore.DataBind();
            }
            setCondition();
        }
Ejemplo n.º 6
0
        private void HandleExit(string pPlanCode)
        {
            if (string.IsNullOrWhiteSpace(pPlanCode))
            {
                return;
            }
            string order_code = PlanFactory.GetOrderCodeByPlan(pPlanCode);
            List <PlanProcessEntity> ent_process = PlanProcessFactory.GetByOrderCode(order_code);
            var s = from a in ent_process where a.ORDER_CODE == orderCode && a.WORKUNIT_CODE == WorkunitCode orderby a.PROCESS_CODE select a.PROCESS_CODE;

            if (s.Count() == 0)
            {
                return;
            }
            string process_code = s.First();

            if (process_code != "0010")
            {
                return;
            }

            List <ProductCompleteEntity> lst = ProductCompleteFactory.GetByPlanStation(planCode, StationCode);
            var s1 = from a in lst where a.COMPLETE_FLAG == "0" select a;

            if (s1.Count() == 0)
            {
                return;
            }
            //如果有complete_time=null记录,则此站点未完成操作

            var s2           = from a in lst where a.COMPLETE_FLAG != "0" select a.BATCH_QTY;
            int complete_qty = s2.Sum();

            PlanEntity ent = PlanFactory.GetByKey(planCode);

            ent.ONLINE_QTY = complete_qty;
            DB.GetInstance().Update(ent);

            DB.GetInstance().Delete(s1.First() as ProductCompleteEntity);
        }
Ejemplo n.º 7
0
        private void initPlan()
        {
            //GridPlan.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            //GridPlan.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            //GridPlan.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            //GridPlan.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            string plineid = LoginInfo.ProductLineInfo.RMES_ID;

            ///得到当前显示的计划集
            string str1 = "";

            if (PlineCode == "L")
            {
                str1 = " and nvl(remark,'C') not like '%单点%'";
            }
            //string sql = "SELECT plan_seq,product_model,plan_code,plan_so,plan_qty,online_qty,offline_qty,customer_name,begin_date,end_date,create_time,remark "
            //     + " FROM data_plan  Where run_flag='Y' and confirm_flag='Y' and plan_type!='C' and plan_type!='D' and pline_code='" + PlineCode + "' AND  plan_qty > online_qty AND to_char(end_date,'yyyymmdd')<=to_char(sysdate+30,'yyyymmdd')  AND to_char(begin_date,'yyyymmdd')>=to_char(sysdate-30,'yyyymmdd') " + str1 + " order by begin_date,plan_seq ";
            //DataTable dt = dataConn.GetTable(sql);
            string sql = "SELECT plan_seq,product_model,plan_code,plan_so,plan_qty,online_qty,offline_qty,customer_name,begin_date,end_date,create_time,remark "
                         + " FROM data_plan  Where run_flag='Y' and confirm_flag='Y' and plan_type!='C' and plan_type!='D' AND to_char(end_date,'yyyymmdd')<=to_char(sysdate+30,'yyyymmdd')  AND to_char(begin_date,'yyyymmdd')>=to_char(sysdate-30,'yyyymmdd') and pline_code='" + PlineCode + "'  order by begin_date desc,plan_seq ";
            DataTable         dt             = dataConn.GetTable(sql);
            List <PlanEntity> currentPlanSet = GridPlan.DataSource as List <PlanEntity>;
            List <PlanEntity> oraclePlanSet  = PlanFactory.GetByPlineCode(PlineCode);

            //如果当前计划集与数据库计划集不同则刷新计划,如果相同则跳过
            if (currentPlanSet != null)
            {
                if (!currentPlanSet.Equals(oraclePlanSet))
                {
                    getPlan(PlineCode);
                }
            }
            else
            {
                getPlan(PlineCode);
            }
        }
Ejemplo n.º 8
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();
        }
Ejemplo n.º 9
0
        private void getPlan(string plinecode)
        {
            //按序显示当前站点的可执行计划
            //List<PlanEntity> ds1 = PlanFactory.GetByPlineID(plineid);
            //修改为按生产线和班组取当日计划并排序:
            List <PlanEntity> ds2 = PlanFactory.GetByPlineCode(plinecode);

            if (ds2 != null && ds2.Count < 1)
            {
                return;
            }
            List <PlanEntity> ds1 = (from p in ds2
                                     where p.RUN_FLAG == "Y"
                                     orderby p.BEGIN_DATE ascending, p.PLAN_SEQ ascending
                                     select p).ToList <PlanEntity>();


            if (ds1.Count == 0)
            {
                GridPlan.DataSource = null; return;
            }
            List <PlanEntity> ds3 = ds1.GetRange(0, ds1.Count);

            foreach (PlanEntity s in ds3)
            {
                int complete_qty = ProductCompleteFactory.GetCompleteQtyByPlanStation(CompanyCode, PlineCode, s.PLAN_CODE, StationCode);
                if (complete_qty >= s.PLAN_QTY)
                {
                    ds1.Remove(s);
                }
                //if (!TheProcessValid(s.PLAN_CODE)) ds1.Remove(s);
            }

            if (ds1.Count == 0)
            {
                GridPlan.DataSource = null; return;
            }
            ;
            PrevPlanNum = ds1.Count;

            GridPlan.DataSource = ds1;
            GridPlan.ClearSelection();
            GridPlan.Rows[0].Selected = true;

            PlanEntity en1       = ds1[0];
            string     plan_code = en1.PLAN_CODE;

            InitPlan(plan_code);

            for (int i = 0; i < GridPlan.Rows.Count; i++)
            {
                //如果完工标识为Y则黄色
                string runFlag = GridPlan.Rows[i].Cells["colrunflag"].Value.ToString();

                //if (runFlag == "F")
                //{
                //    for (int j = 0; j < GridPlan.Columns.Count; j++)
                //        GridPlan.Rows[i].Cells[j].Style.BackColor = Color.Yellow;
                //}
                //如果完工标识为Y,实际上线数量>0则绿色
                int realOnlineQuantity = Convert.ToInt32(GridPlan.Rows[i].Cells["ColRealOnlineQuantity"].Value.ToString());
                if (realOnlineQuantity > 0 && runFlag == "Y")
                {
                    for (int j = 0; j < GridPlan.Columns.Count; j++)
                    {
                        GridPlan.Rows[i].Cells[j].Style.BackColor = Color.Green;
                    }
                }
                //挂起
                if (runFlag == "G")
                {
                    for (int j = 0; j < GridPlan.Columns.Count; j++)
                    {
                        GridPlan.Rows[i].Cells[j].Style.BackColor = Color.Red;
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public List <PlanProcessEntity> GetByPlan(string PlanCode)
        {
            string order_code = PlanFactory.GetOrderCodeByPlan(PlanCode);

            return(db.Fetch <PlanProcessEntity>("WHERE ORDER_CODE=@0 order by process_code", order_code));
        }
Ejemplo n.º 11
0
        public PreemptRequestChart(PreemptServiceRequestOptions options, ControllerEventLogs dttb)
        {
            Options = options;
            //Set the chart properties
            PreemptServiceRequestChart = ChartFactory.CreateDefaultChart(options);
            PreemptServiceRequestChart.ImageStorageMode = ImageStorageMode.UseImageLocation;
            ChartFactory.SetImageProperties(PreemptServiceRequestChart);
            PreemptServiceRequestChart.BorderSkin.SkinStyle   = BorderSkinStyle.None;
            PreemptServiceRequestChart.BorderSkin.BorderColor = Color.Black;
            PreemptServiceRequestChart.BorderSkin.BorderWidth = 1;
            var reportTimespan = Options.EndDate - Options.StartDate;

            SetChartTitle();

            //Create the chart legend
            var chartLegend = new Legend();

            chartLegend.Name    = "MainLegend";
            chartLegend.Docking = Docking.Left;
            PreemptServiceRequestChart.Legends.Add(chartLegend);
            PreemptServiceRequestChart.ChartAreas[0].AxisY.Maximum  = 10;
            PreemptServiceRequestChart.ChartAreas[0].AxisX2.Enabled = AxisEnabled.False;

            // top chart

            PreemptServiceRequestChart.ChartAreas[0].AxisY.Minimum           = 0;
            PreemptServiceRequestChart.ChartAreas[0].AxisY.Title             = "Preempt Number";
            PreemptServiceRequestChart.ChartAreas[0].AxisY.Interval          = 1;
            PreemptServiceRequestChart.ChartAreas[0].AxisX.Title             = "Time (Hours:Minutes)";
            PreemptServiceRequestChart.ChartAreas[0].AxisX.IntervalType      = DateTimeIntervalType.Hours;
            PreemptServiceRequestChart.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm";
            if (reportTimespan.Days <= 1)
            {
                if (reportTimespan.Hours > 1)
                {
                    PreemptServiceRequestChart.ChartAreas[0].AxisX.Interval = 1;
                }
                else
                {
                    PreemptServiceRequestChart.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm";
                }
            }
            PreemptServiceRequestChart.ChartAreas[0].AxisX.Minimum = Options.StartDate.ToOADate();
            PreemptServiceRequestChart.ChartAreas[0].AxisX.Maximum = Options.EndDate.ToOADate();

            //Add the point series

            var PreemptSeries = new Series();

            PreemptSeries.ChartType       = SeriesChartType.Point;
            PreemptSeries.BorderDashStyle = ChartDashStyle.Dash;
            PreemptSeries.MarkerStyle     = MarkerStyle.Diamond;
            PreemptSeries.Color           = Color.Black;
            PreemptSeries.Name            = "Preempt Request";
            PreemptSeries.XValueType      = ChartValueType.DateTime;


            //Add the Posts series to ensure the chart is the size of the selected timespan
            var posts = new Series();

            posts.IsVisibleInLegend = false;
            posts.ChartType         = SeriesChartType.Point;
            posts.Color             = Color.White;
            posts.Name       = "Posts";
            posts.XValueType = ChartValueType.DateTime;

            PreemptServiceRequestChart.Series.Add(posts);
            PreemptServiceRequestChart.Series.Add(PreemptSeries);
            PreemptServiceRequestChart.Height = 200;
            //Add points at the start and and of the x axis to ensure
            //the graph covers the entire period selected by the user
            //whether there is data or not
            //chart.Series["Posts"].Points.AddXY(Options.StartDate, 0);
            //chart.Series["Posts"].Points.AddXY(Options.EndDate, 0);

            AddDataToChart(PreemptServiceRequestChart, Options.StartDate, Options.EndDate, dttb, Options.SignalID);
            var plans = PlanFactory.GetBasicPlans(Options.StartDate, Options.EndDate, Options.SignalID);

            SetSimplePlanStrips(plans, PreemptServiceRequestChart, Options.StartDate, dttb);
        }
Ejemplo n.º 12
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;
            }
        }
Ejemplo n.º 13
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;
                }
            }
        }
Ejemplo n.º 14
0
        public void BindData()
        {
            string        plineCode;
            List <object> _planSO = gridLookupItem.GridView.GetSelectedFieldValues("WBS_CODE");

            if (_planSO == null || _planSO.Count == 0)
            {
                return;
            }
            if (ComPline.SelectedItem != null)
            {
                plineCode = ComPline.SelectedItem.Value.ToString();
            }
            else
            {
                plineCode = "";
            }
            //if (string.IsNullOrEmpty(plineCode)) return;
            List <PlanEntity> entity = PlanFactory.GetByCreatePeriod(cdate1.Date, cdate2.Date);


            if (_planSO != null && _planSO.Count > 0)
            {
                //entity = (from s in entity where _planSO.Contains(s.WBS_CODE) select s).ToList<PlanEntity>();
            }

            if (!ComPline.SelectedItem.Value.ToString().Equals("All"))
            {
                entity = (from s in entity where s.PLINE_CODE == plineCode select s).ToList <PlanEntity>();
            }
            ASPxGridView1.DataSource = entity;
            XtraReport3 re = new XtraReport3(entity);

            ReportViewer1.Report = re;
            GridViewDataComboBoxColumn colPline      = ASPxGridView1.Columns["PLINE_CODE"] as GridViewDataComboBoxColumn;
            List <ProductLineEntity>   plineEntities = ProductLineFactory.GetAll();

            colPline.PropertiesComboBox.DataSource = plineEntities;
            colPline.PropertiesComboBox.ValueField = "RMES_ID";
            colPline.PropertiesComboBox.TextField  = "PLINE_NAME";

            DataTable itemDT = new DataTable();

            itemDT.Columns.Add("Value");
            itemDT.Columns.Add("Text");
            itemDT.Rows.Add("Y", "已收料");
            itemDT.Rows.Add("B", "已发料单");
            itemDT.Rows.Add("N", "未确认");
            GridViewDataComboBoxColumn itemCol = ASPxGridView1.Columns["ITEM_FLAG"] as GridViewDataComboBoxColumn;

            itemCol.PropertiesComboBox.DataSource = itemDT;
            itemCol.PropertiesComboBox.ValueField = "Value";
            itemCol.PropertiesComboBox.TextField  = "Text";


            DataTable runDT = new DataTable();

            runDT.Columns.Add("Value");
            runDT.Columns.Add("Text");
            runDT.Rows.Add("Y", "执行中");
            runDT.Rows.Add("N", "未执行");
            runDT.Rows.Add("P", "暂停中");
            runDT.Rows.Add("F", "已完成");
            GridViewDataComboBoxColumn runCol = ASPxGridView1.Columns["RUN_FLAG"] as GridViewDataComboBoxColumn;

            runCol.PropertiesComboBox.DataSource = runDT;
            runCol.PropertiesComboBox.ValueField = "Value";
            runCol.PropertiesComboBox.TextField  = "Text";


            List <UserEntity>          allusers    = UserFactory.GetAll();
            GridViewDataComboBoxColumn create_user = ASPxGridView1.Columns["CREATE_USER_ID"] as GridViewDataComboBoxColumn;

            create_user.PropertiesComboBox.DataSource = allusers;
            create_user.PropertiesComboBox.ValueField = "USER_ID";
            create_user.PropertiesComboBox.TextField  = "USER_NAME";
            DataTable typeDT = new DataTable();

            typeDT.Columns.Add("Value");
            typeDT.Columns.Add("Text");
            typeDT.Rows.Add("ZP01", "标准");
            typeDT.Rows.Add("ZP02", "返工");
            typeDT.Rows.Add("ZP03", "拆解");
            GridViewDataComboBoxColumn typeCol = ASPxGridView1.Columns["PLAN_TYPE_CODE"] as GridViewDataComboBoxColumn;

            typeCol.PropertiesComboBox.DataSource = typeDT;
            typeCol.PropertiesComboBox.ValueField = "Value";
            typeCol.PropertiesComboBox.TextField  = "Text";


            ASPxGridView1.DataBind();
        }
Ejemplo n.º 15
0
        protected void ASPxCbSubmit_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            try
            {
                string[] collection = e.Parameter.Split('@');
                int      cnt        = collection.Length;
                string   value      = collection[1]; //计划号

                if (collection[0] == "Commit")
                {
                    if (value.EndsWith(","))
                    {
                        value = value.Substring(0, value.Length - 1);
                    }
                    string[] _ids      = value.Split(',');
                    string   plancode  = _ids[0].ToUpper();
                    string   planso    = _ids[1];
                    string   planqty   = _ids[2];
                    string   changeqty = _ids[3];
                    //根据计划号判断该用户是否有该生产线权限
                    string sql = "select run_flag,online_qty,third_flag from data_plan where plan_code='" + plancode + "' and plan_type='A' and pline_code in "
                                 + " (select pline_code from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + programcode + "' and company_code='" + theCompanyCode + "' )";
                    DataTable dt = dc.GetTable(sql);
                    if (dt.Rows.Count == 0)
                    {
                        e.Result = "Fail,无该计划生产线权限!";
                        return;
                    }
                    string runflag   = dt.Rows[0][0].ToString();
                    string onlineqty = dt.Rows[0][1].ToString();
                    string thirdflag = dt.Rows[0][2].ToString();
                    if (thirdflag == "N")
                    {
                        e.Result = "Fail,该计划未进行三方物料计算!";
                        return;
                    }
                    if (onlineqty != "0" || runflag == "Y")
                    {
                        e.Result = "Fail,该计划已上线!";
                        return;
                    }
                    int count2 = Convert.ToInt32(dc.GetValue("select count(1) from data_plan_sn where sn_flag='N' and plan_code='" + plancode + "'"));
                    if (count2 < Convert.ToInt32(changeqty))
                    {
                        e.Result = "Fail,该计划未上线流水号数量小于调整数量!";
                        return;
                    }
                    string plinecode = "";
                    plinecode = dc.GetValue("select nvl(pline_code,'') from data_plan where plan_code='" + plancode + "'");
                    PlanFactory.MS_HANDLE_PLAN_ADJUST("DELETE", plinecode, plancode, planso, planqty, changeqty, theUserCode);

                    string sql1 = "INSERT INTO data_plan_LOG(RMES_ID,COMPANY_CODE,PLINE_CODE,PLINE_NAME,PLAN_SEQ,PLAN_CODE,PLAN_SO,PRODUCT_MODEL,PLAN_TYPE,CREATE_USERID,CREATE_USERNAME,CREATE_TIME,BEGIN_DATE,END_DATE,ACCOUNT_DATE,PLAN_QTY,ONLINE_QTY,OFFLINE_QTY,ROUNTING_SITE,ROUNTING_REMARK,CUSTOMER_CODE,CUSTOMER_NAME,ORDER_CODE,REMARK,ROUNTING_CODE,LQ_FLAG,CONFIRM_FLAG,RUN_FLAG,BOM_FLAG,ITEM_FLAG,SN_FLAG,THIRD_FLAG,STOCK_FLAG,THIRD_RECEIVE_FLAG,STOCK_RECEIVE_FLAG,modify_user,modify_time,modify_type,is_bom) "
                                  + " SELECT RMES_ID,COMPANY_CODE,PLINE_CODE,PLINE_NAME,PLAN_SEQ,PLAN_CODE,PLAN_SO,PRODUCT_MODEL,PLAN_TYPE,CREATE_USERID,CREATE_USERNAME,CREATE_TIME,BEGIN_DATE,END_DATE,ACCOUNT_DATE,PLAN_QTY,ONLINE_QTY,OFFLINE_QTY,ROUNTING_SITE,ROUNTING_REMARK,CUSTOMER_CODE,CUSTOMER_NAME,ORDER_CODE,REMARK,ROUNTING_CODE,LQ_FLAG,CONFIRM_FLAG,RUN_FLAG,BOM_FLAG,ITEM_FLAG,SN_FLAG,THIRD_FLAG,STOCK_FLAG,THIRD_RECEIVE_FLAG,STOCK_RECEIVE_FLAG,'" + theUserName + "',SYSDATE,'修改前记录','Y' "
                                  + " FROM data_plan WHERE  TRIM(plan_code) = '" + plancode + "' ";
                    dc.ExeSql(sql1);
                    int qty = Convert.ToInt32(planqty) - Convert.ToInt32(changeqty);
                    sql1 = "update data_plan set plan_qty=" + qty + " where plan_code = '" + plancode + "' ";
                    dc.ExeSql(sql1);
                    sql1 = "  INSERT INTO DATA_PLANLOG(plan_so,plan_code,create_date,remark,modify_type,plan_seq,pline_code,rounting_site) "
                           + " select plan_so,plan_code,sysdate, '修改计划','修改',to_number(plan_seq),pline_code,rounting_site from data_plan "
                           + " where plan_code = '" + plancode + "' ";
                    dc.ExeSql(sql1);
                    sql1 = "INSERT INTO data_plan_LOG(RMES_ID,COMPANY_CODE,PLINE_CODE,PLINE_NAME,PLAN_SEQ,PLAN_CODE,PLAN_SO,PRODUCT_MODEL,PLAN_TYPE,CREATE_USERID,CREATE_USERNAME,CREATE_TIME,BEGIN_DATE,END_DATE,ACCOUNT_DATE,PLAN_QTY,ONLINE_QTY,OFFLINE_QTY,ROUNTING_SITE,ROUNTING_REMARK,CUSTOMER_CODE,CUSTOMER_NAME,ORDER_CODE,REMARK,ROUNTING_CODE,LQ_FLAG,CONFIRM_FLAG,RUN_FLAG,BOM_FLAG,ITEM_FLAG,SN_FLAG,THIRD_FLAG,STOCK_FLAG,THIRD_RECEIVE_FLAG,STOCK_RECEIVE_FLAG,modify_user,modify_time,modify_type,is_bom) "
                           + " SELECT RMES_ID,COMPANY_CODE,PLINE_CODE,PLINE_NAME,PLAN_SEQ,PLAN_CODE,PLAN_SO,PRODUCT_MODEL,PLAN_TYPE,CREATE_USERID,CREATE_USERNAME,CREATE_TIME,BEGIN_DATE,END_DATE,ACCOUNT_DATE,PLAN_QTY,ONLINE_QTY,OFFLINE_QTY,ROUNTING_SITE,ROUNTING_REMARK,CUSTOMER_CODE,CUSTOMER_NAME,ORDER_CODE,REMARK,ROUNTING_CODE,LQ_FLAG,CONFIRM_FLAG,RUN_FLAG,BOM_FLAG,ITEM_FLAG,SN_FLAG,THIRD_FLAG,STOCK_FLAG,THIRD_RECEIVE_FLAG,STOCK_RECEIVE_FLAG,'" + theUserName + "',SYSDATE,'修改后记录','Y' "
                           + " FROM data_plan WHERE  TRIM(plan_code) = '" + plancode + "'";
                    dc.ExeSql(sql1);

                    //回收流水号
                    for (int i = 0; i < Convert.ToInt32(changeqty); i++)
                    {
                        int count1 = Convert.ToInt32(dc.GetValue("select count(1) from data_plan_sn where sn_flag='N' and plan_code='" + plancode + "'"));
                        if (count1 > 0)
                        {
                            string sn1 = dc.GetValue("select sn from data_plan_sn where sn_flag='N' and plan_code='" + plancode + "' and rownum=1 ");
                            dc.ExeSql("insert into code_sn_reserve(rmes_id,company_code,pline_code,sn,sn_flag) values(seq_rmes_id.nextval,'" + theCompanyCode + "','" + plinecode + "','" + sn1 + "','A') ");
                            dc.ExeSql("delete from data_plan_sn where sn='" + sn1 + "' ");
                        }
                    }
                    //判断分装计划是否上线
                    sql = "select count(1) from data_plan where plan_code like 'F%" + plancode + "' and plan_type='F'";
                    if (dc.GetValue(sql) != "0")
                    {
                        sql1 = "select count(1) from data_product where plan_code like 'F%" + plancode + "'";
                        if (dc.GetValue(sql1) == "0")
                        {
                            //string Rsite = RSite.SelectedItem.Value.ToString();
                            sql1 = "INSERT INTO data_plan_LOG(RMES_ID,COMPANY_CODE,PLINE_CODE,PLINE_NAME,PLAN_SEQ,PLAN_CODE,PLAN_SO,PRODUCT_MODEL,PLAN_TYPE,CREATE_USERID,CREATE_USERNAME,CREATE_TIME,BEGIN_DATE,END_DATE,ACCOUNT_DATE,PLAN_QTY,ONLINE_QTY,OFFLINE_QTY,ROUNTING_SITE,ROUNTING_REMARK,CUSTOMER_CODE,CUSTOMER_NAME,ORDER_CODE,REMARK,ROUNTING_CODE,LQ_FLAG,CONFIRM_FLAG,RUN_FLAG,BOM_FLAG,ITEM_FLAG,SN_FLAG,THIRD_FLAG,STOCK_FLAG,THIRD_RECEIVE_FLAG,STOCK_RECEIVE_FLAG,modify_user,modify_time,modify_type,is_bom) "
                                   + " SELECT RMES_ID,COMPANY_CODE,PLINE_CODE,PLINE_NAME,PLAN_SEQ,PLAN_CODE,PLAN_SO,PRODUCT_MODEL,PLAN_TYPE,CREATE_USERID,CREATE_USERNAME,CREATE_TIME,BEGIN_DATE,END_DATE,ACCOUNT_DATE,PLAN_QTY,ONLINE_QTY,OFFLINE_QTY,ROUNTING_SITE,ROUNTING_REMARK,CUSTOMER_CODE,CUSTOMER_NAME,ORDER_CODE,REMARK,ROUNTING_CODE,LQ_FLAG,CONFIRM_FLAG,RUN_FLAG,BOM_FLAG,ITEM_FLAG,SN_FLAG,THIRD_FLAG,STOCK_FLAG,THIRD_RECEIVE_FLAG,STOCK_RECEIVE_FLAG,'" + theUserName + "',SYSDATE,'修改前记录','Y' "
                                   + " FROM data_plan WHERE  TRIM(plan_code)like 'F%" + plancode + "'  and plan_type='F'";
                            dc.ExeSql(sql1);
                            sql1 = "update data_plan set plan_qty=to_number('" + qty + "') where plan_code like 'F%" + plancode + "' and plan_type='F'  ";
                            dc.ExeSql(sql1);
                            sql1 = "  INSERT INTO DATA_PLANLOG(plan_so,plan_code,create_date,remark,modify_type,plan_seq,pline_code,rounting_site) "
                                   + " select plan_so,plan_code,sysdate, '修改计划','修改',to_number(plan_seq),pline_code,rounting_site from data_plan "
                                   + " where plan_code like 'F%" + plancode + "' and plan_type='F'  ";
                            dc.ExeSql(sql1);
                            sql1 = "INSERT INTO data_plan_LOG(RMES_ID,COMPANY_CODE,PLINE_CODE,PLINE_NAME,PLAN_SEQ,PLAN_CODE,PLAN_SO,PRODUCT_MODEL,PLAN_TYPE,CREATE_USERID,CREATE_USERNAME,CREATE_TIME,BEGIN_DATE,END_DATE,ACCOUNT_DATE,PLAN_QTY,ONLINE_QTY,OFFLINE_QTY,ROUNTING_SITE,ROUNTING_REMARK,CUSTOMER_CODE,CUSTOMER_NAME,ORDER_CODE,REMARK,ROUNTING_CODE,LQ_FLAG,CONFIRM_FLAG,RUN_FLAG,BOM_FLAG,ITEM_FLAG,SN_FLAG,THIRD_FLAG,STOCK_FLAG,THIRD_RECEIVE_FLAG,STOCK_RECEIVE_FLAG,modify_user,modify_time,modify_type,is_bom) "
                                   + " SELECT RMES_ID,COMPANY_CODE,PLINE_CODE,PLINE_NAME,PLAN_SEQ,PLAN_CODE,PLAN_SO,PRODUCT_MODEL,PLAN_TYPE,CREATE_USERID,CREATE_USERNAME,CREATE_TIME,BEGIN_DATE,END_DATE,ACCOUNT_DATE,PLAN_QTY,ONLINE_QTY,OFFLINE_QTY,ROUNTING_SITE,ROUNTING_REMARK,CUSTOMER_CODE,CUSTOMER_NAME,ORDER_CODE,REMARK,ROUNTING_CODE,LQ_FLAG,CONFIRM_FLAG,RUN_FLAG,BOM_FLAG,ITEM_FLAG,SN_FLAG,THIRD_FLAG,STOCK_FLAG,THIRD_RECEIVE_FLAG,STOCK_RECEIVE_FLAG,'" + theUserName + "',SYSDATE,'修改后记录','Y' "
                                   + " FROM data_plan WHERE  TRIM(plan_code)like 'F%" + plancode + "'  and plan_type='F'";
                            dc.ExeSql(sql1);
                        }
                    }

                    e.Result = "OK,三方物料计划取消提交成功!";
                    return;
                }
                else
                if (collection[0] == "Check")
                {
                    string plancode = collection[1];     //计划号
                    //根据计划号判断该用户是否有该生产线权限
                    string sql = "select run_flag,online_qty,third_flag from data_plan where plan_code='" + plancode + "' and plan_type='A' and pline_code in "
                                 + " (select pline_code from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + programcode + "' and company_code='" + theCompanyCode + "' )";
                    DataTable dt = dc.GetTable(sql);
                    if (dt.Rows.Count == 0)
                    {
                        e.Result = "Fail,无该计划生产线权限!";
                        return;
                    }
                    string runflag   = dt.Rows[0][0].ToString();
                    string onlineqty = dt.Rows[0][1].ToString();
                    string thirdflag = dt.Rows[0][2].ToString();
                    if (thirdflag == "N")
                    {
                        e.Result = "Fail,该计划未进行三方物料计算!";
                        return;
                    }
                    if (onlineqty != "0" || runflag == "Y")
                    {
                        e.Result = "Fail,该计划已上线!";
                        return;
                    }
                    e.Result = "OK1,OK";
                }
            }
            catch (Exception e1)
            {
                e.Result = "Fail,三方物料计划取消提交失败" + e1.Message + "!";
                return;
            }
        }
Ejemplo n.º 16
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;
            }
        }