コード例 #1
0
        private void getPlan(string plinecode)
        {
            //按序显示当前站点的可执行计划
            //List<PlanEntity> ds1 = PlanFactory.GetByPlineID(plineid);
            //修改为按生产线和班组取当日计划并排序:
            List <PlanEntity> ds2 = PlanFactory.GetByPlineCode1(plinecode);

            if (ds2 != null && ds2.Count < 1)
            {
                return;
            }
            List <PlanEntity> ds1 = (from p in ds2
                                     where p.RUN_FLAG == "Y"
                                     orderby p.BEGIN_DATE descending, 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;
                    }
                }
            }
        }