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); }
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)); }