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); }
private bool DealSn(string pSn) { string sn = pSn; RMESEventArgs arg = new RMESEventArgs(); PlanSnEntity plansn1 = PlanSnFactory.GetBySn(sn); if (plansn1 == null) { return(false); } arg.MessageHead = plansn1.SN_FLAG == "N" ? "ONLINE" : "SN"; string plan_code = plansn1.PLAN_CODE; string quality_status = "A", complete_flag = "0"; List <ProductCompleteEntity> prc = ProductCompleteFactory.GetByPlanSn(CompanyCode, PlineCode, plan_code, sn, StationCode); if (prc.Count > 0) { complete_flag = prc.First <ProductCompleteEntity>().COMPLETE_FLAG; } if (complete_flag == "1") { MessageBox.Show("此项装配任务已经完成下线"); return(false); } List <ProductDataEntity> prd = ProductDataFactory.GetProductDataByPlanSn(CompanyCode, PlineCode, plan_code, sn); //if (prd.Count > 0) quality_status = prd.First<ProductDataEntity>().QUALITY_STATUS; if (quality_status == "B") { DialogResult dlg = MessageBox.Show("此项装配工件质量不合格,要继续装配吗", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlg == DialogResult.No) { return(false); } } return(true); }
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; } } } }