Esempio n. 1
0
        public string A14HistoryList(string WorkFlow_Name, string yearandmonth)
        {
            string username = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;


            string WE_Status       = "3";
            string query_list      = "distinct E.WE_Ser, E.WE_Id, R.username,R.time";
            string query_condition = "E.W_Name='" + WorkFlow_Name + "' and E.WE_Status='" + WE_Status + "' and R.username is not null";
            string record_filter;
            string nexttimepoint;

            string[] month = yearandmonth.Split('/');
            nexttimepoint = month[0] + "/" + (Convert.ToInt16(month[1]) + 1).ToString();
            record_filter = "time >= '" + yearandmonth + "/" + "1" + " 00:00:00'" + "and  time <= '" + nexttimepoint + "/" + "1" + " 00:00:00'";
            DataTable dt  = CWFEngine.QueryAllInformation(query_list, query_condition, record_filter);
            DataTable dt2 = DeleteSameRow(dt, "WE_Ser");
            string    str = "";//存返回结果

            List <Gxqmodel> Gmlist = new List <Gxqmodel>();

            for (int i = 0; i < dt2.Rows.Count; i++)
            {
                Gxqmodel Gm = new Gxqmodel();
                Gm.WE_Id  = Convert.ToInt16(dt.Rows[i]["WE_Id"]);
                Gm.WE_Ser = dt.Rows[i]["WE_Ser"].ToString();
                Gmlist.Add(Gm);
            }
            List <HistroyModel> Hm = new List <HistroyModel>();

            foreach (var item in Gmlist)
            {
                HistroyModel h = new HistroyModel();
                Dictionary <string, object> paras = new Dictionary <string, object>();
                paras["Equip_GyCode"] = null;
                UI_WFEntity_Info  wfei           = CWFEngine.GetWorkFlowEntityWithParams(item.WE_Id, paras);
                List <UI_MISSION> AllHistoryMiss = CWFEngine.GetHistoryMissions(item.WE_Id);
                int Miss_Id = AllHistoryMiss[0].Miss_Id;
                h.miss_LastStatusdesc = AllHistoryMiss[AllHistoryMiss.Count - 1].WE_Event_Desc;
                IDictionary <string, string> r = CWFEngine.GetMissionRecordInfo(Miss_Id);
                if (r.Count > 0)
                {
                    h.missStartName = r["username"];
                    h.missStartTime = r["time"];
                }
                else
                {
                    h.missStartName = "";
                    h.missStartTime = "";
                }

                h.wfe_serial = item.WE_Ser;
                // h.miss_wfe_Id = wfei.EntityID;
                h.miss_wfe_Id  = item.WE_Id;
                h.workFlowName = wfei.description;
                h.sbGycode     = paras["Equip_GyCode"].ToString();
                Hm.Add(h);
            }
            List <object> or = new List <object>();

            for (int i = 0; i < Hm.Count; i++)
            {
                object o = new
                {
                    wfe_serial          = Hm[i].wfe_serial,
                    equip_gycode        = Hm[i].sbGycode,
                    workflow_name       = Hm[i].workFlowName,
                    missStartName       = Hm[i].missStartName,
                    missStartTime       = Hm[i].missStartTime,
                    miss_LastStatusdesc = Hm[i].miss_LastStatusdesc,
                    miss_wfe_Id         = Hm[i].miss_wfe_Id
                };
                or.Add(o);
            }
            str = JsonConvert.SerializeObject(or);

            return("{" + "\"data\": " + str + "}");
        }
Esempio n. 2
0
        public string A8ActiveList(string WorkFlow_Name)
        {
            string username = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;


            string          WE_Status       = "0";
            string          query_list      = "distinct E.WE_Ser, E.WE_Id, R.username";
            string          query_condition = "E.W_Name='" + WorkFlow_Name + "' and E.WE_Status='" + WE_Status + "' and R.username is not null";
            string          record_filter   = "username is not null";
            DataTable       dt     = CWFEngine.QueryAllInformation(query_list, query_condition, record_filter);
            List <Gxqmodel> Gmlist = new List <Gxqmodel>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Gxqmodel Gm = new Gxqmodel();
                Gm.WE_Id  = Convert.ToInt16(dt.Rows[i]["WE_Id"]);
                Gm.WE_Ser = dt.Rows[i]["WE_Ser"].ToString();
                Gmlist.Add(Gm);
            }
            List <A8Model>    Hm  = new List <A8Model>();
            ERPInfoManagement erp = new ERPInfoManagement();

            foreach (var item in Gmlist)
            {
                A8Model h = new A8Model();

                Dictionary <string, object> paras = new Dictionary <string, object>();
                paras["Equip_GyCode"] = null;
                paras["Job_Order"]    = null; //通过工单找通知单号
                paras["Zz_Name"]      = null;
                paras["Job_Name"]     = null; //计划名称

                UI_WFEntity_Info wfei = CWFEngine.GetWorkFlowEntityWithParams(item.WE_Id, paras);
                h.zz_name   = paras["Zz_Name"].ToString();
                h.sb_gycode = paras["Equip_GyCode"].ToString();
                h.job_order = paras["Job_Order"].ToString();
                h.plan_name = paras["Job_Name"].ToString();
                GD_InfoModal res = erp.getGD_Modal_GDId(paras["Job_Order"].ToString());
                if (res != null)
                {
                    h.notice_order = res.GD_Notice_Id;
                }
                h.gd_state = "检修中";
                WorkFlows wfsd          = new WorkFlows();
                Mission   db_missA8dot2 = wfsd.GetWFEntityMissions(item.WE_Id).Last();
                //写if而不写else if是因为13.1和8.2是断开的,跳转8.2仍满足db_miss.Miss_Desc == "专业团队审核"
                if (db_missA8dot2.Miss_Desc == "检修单位按计划建立工单,完善工序、组件")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "检修计划提报")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "现场工程师审核工单")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "专业团队审1")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "可靠性工程师审1")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "机动处计划科审2")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "物资处采购,填写到货时间")
                {
                    h.gd_state = "物资采购中";
                }
                else if (db_missA8dot2.Miss_Desc == "物资处确认到货并通知检修单位")
                {
                    h.gd_state = "物资已到货";
                }
                else if (db_missA8dot2.Miss_Desc == "检修单位上传检修方案" || db_missA8dot2.Miss_Desc == "专业团队审批" || db_missA8dot2.Miss_Desc == "检修单位填写检修内容及关键工序,关联作业指导书" || db_missA8dot2.Miss_Desc == "可靠性工程师审批")
                {
                    h.gd_state = "检修方案制定与审判";
                }
                else if (db_missA8dot2.Miss_Desc == "现场工程师确认是否可实施计划")
                {
                    UI_MISSION           ui       = new UI_MISSION();
                    List <Mission_Param> mis_pars = wfsd.GetMissParams(db_missA8dot2.Miss_Id);//获取当前任务参数
                    foreach (var par in mis_pars)
                    {
                        CParam cp = new CParam();
                        ui.Miss_Params[cp.name] = cp.value;
                    }
                    if (ui.Miss_Params["ZzConfirmPlan_Result"].ToString() == "是")
                    {
                        h.gd_state = "检修计划实施中";
                    }
                    else if (ui.Miss_Params["ZzConfirmPlan_Result"].ToString() == "否")
                    {
                        h.gd_state = "检修计划延期";
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "检修单位确认施工完毕,上传交工资料")
                {
                    h.gd_state = "处理完成";
                }
                h.Data_Src = "待定";
                h.detail   = "待定";
                Hm.Add(h);
            }
            List <object> or = new List <object>();

            for (int i = 0; i < Hm.Count; i++)
            {
                object o = new
                {
                    index        = i + 1,
                    equip_gycode = Hm[i].sb_gycode,
                    job_order    = Hm[i].job_order,
                    notice_order = Hm[i].notice_order,
                    gd_state     = Hm[i].gd_state,
                    datasrc      = Hm[i].Data_Src,
                    detail       = Hm[i].detail,
                    zzname       = Hm[i].zz_name,
                    planname     = Hm[i].plan_name
                };
                or.Add(o);
            }
            string str = JsonConvert.SerializeObject(or);

            return("{" + "\"data\": " + str + "}");
        }