Ejemplo n.º 1
0
        /// <summary>
        /// 此函数负责对比当前显示计划与计划表的差异,对比结果通知主线程
        /// </summary>
        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 pline_code='" + PlineCode + "' AND  plan_qty > online_qty  " + str1 + " order by begin_date,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.º 2
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;
                    }
                }
            }
        }