Ejemplo n.º 1
0
        public string CreateA12dot2_submitsignal(string json1)
        {
            try
            {
                JObject        item    = (JObject)JsonConvert.DeserializeObject(json1);
                EquipManagment tm      = new EquipManagment();
                string         temp    = item["sample"].ToString();
                JArray         jsonVal = JArray.Parse(temp) as JArray;
                dynamic        table2  = jsonVal;
                foreach (dynamic T in table2)
                {
                    UI_WorkFlow_Entity          wfe    = CWFEngine.CreateAWFEntityByName("A12dot2");
                    Dictionary <string, string> record = wfe.GetRecordItems();
                    record["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                    record["time"]     = DateTime.Now.ToString();

                    string returl = wfe.Start(record);
                    Dictionary <string, string> signal = new Dictionary <string, string>();
                    string Equip_Code           = T.Equip_Code;
                    int    Equip_location_EA_Id = tm.getEA_id_byCode(Equip_Code);
                    signal["currentuser"]   = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                    signal["start_done"]    = "true";
                    signal["Zz_Name"]       = tm.getZzName(Equip_location_EA_Id);
                    signal["Equip_GyCode"]  = T.Equip_GyCode;
                    signal["Equip_Code"]    = T.Equip_Code;
                    signal["Equip_ABCMark"] = T.Equip_ABCMark;

                    //record
                    Dictionary <string, string> record1 = new Dictionary <string, string>();
                    record1["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                    record1["time"]     = DateTime.Now.ToString();
                    //submit
                    CWFEngine.SubmitSignal(Convert.ToInt32(wfe.EntityID), signal, record1);
                }
            }
            catch (Exception e)
            {
                return("");
            }
            return("/A12dot2/Index");
        }
Ejemplo n.º 2
0
        public JsonResult A6dot2GetTimerJobs(string run_result)
        {
            string        run_results  = run_result.TrimStart('[').TrimEnd(']');
            List <string> run_enity_id = new List <string>();
            List <object> res          = new List <object>();


            if (run_results.Contains(','))
            {
                run_enity_id = run_results.Split(new char[] { ',' }).ToList();
            }
            else
            {
                run_enity_id.Add(run_results);
            }

            for (int i = 0; i < run_enity_id.Count; i++)
            {
                List <string> Zz_list = new List <string>();                 //整改方案

                List <string> equip_list              = new List <string>(); //设备name
                List <string> equip_code_list         = new List <string>(); //设备code
                List <string> equip_file_list         = new List <string>(); //整改方案
                List <string> equip_check_result_list = new List <string>(); //化验结果



                Dictionary <string, object> paras = new Dictionary <string, object>();
                paras["Cj_Name"]            = null;
                paras["Equip_Info"]         = null;
                paras["Assay_Result"]       = null;
                paras["Time_Assay"]         = null;
                paras["Assay_File"]         = null;
                paras["Xc_Confirm"]         = null;
                paras["Assay_Result_Again"] = null;

                UI_WFEntity_Info wfei = CWFEngine.GetWorkFlowEntityWithParams(Convert.ToInt16(run_enity_id[i]), paras);
                if (paras["Equip_Info"].ToString() != "")
                {
                    JArray  jsonVal = JArray.Parse(paras["Equip_Info"].ToString());
                    dynamic table   = jsonVal;
                    foreach (dynamic T in table)
                    {
                        string eq_name = T.equip_name;
                        equip_list.Add(eq_name);
                        string eq_code = T.equip_code;
                        equip_code_list.Add(eq_code);
                        string equip_file = T.equip_file;
                        equip_file_list.Add(equip_file);
                        string equip_check_result = T.equip_check_result;
                        equip_check_result_list.Add(equip_check_result);
                    }

                    for (int k = 0; k < equip_list.Count; k++)
                    {
                        object o = new
                        {
                            ID                  = k + 1,
                            zz_name             = Em.getZzName(Convert.ToInt16(Em.getEA_id_byCode(equip_code_list[k]))),
                            jz_name             = equip_list[k],
                            sb_code             = equip_code_list[k],
                            last_check_month    = paras["Time_Assay"].ToString(),
                            check_result        = equip_check_result_list[k],
                            zz_file             = equip_file_list[k],
                            zz_done             = paras["Xc_Confirm"].ToString(),
                            second_check_result = paras["Assay_Result_Again"].ToString()
                        };

                        res.Add(o);
                    }
                }
            }



            return(Json(new { data = res.ToArray() }));
        }
Ejemplo n.º 3
0
        public string CreateA14dot3s_submitsignal(string json1)
        {
            try
            {
                JObject        item    = (JObject)JsonConvert.DeserializeObject(json1);
                EquipManagment tm      = new EquipManagment();
                string         temp    = item["sample"].ToString();
                JArray         jsonVal = JArray.Parse(temp) as JArray;
                dynamic        table2  = jsonVal;
                foreach (dynamic T in table2)
                {
                    //加载原工作流工作流
                    CWorkFlow       m_workFlow = new CWorkFlow();
                    WorkFlows       wfs        = new WorkFlows();
                    WorkFlow_Define wf_define  = wfs.GetWorkFlowDefine("A14dot3dot3");
                    m_workFlow = null;
                    if (wf_define != null)
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(Encoding.Default.GetString(wf_define.W_Xml));
                        m_workFlow = new CWorkFlow();
                        m_workFlow.InstFromXmlNode((XmlNode)doc.DocumentElement);
                        m_workFlow.DefineID = wf_define.W_ID;
                    }

                    //加载超时属性数据
                    TimerCreateWFPa TCP = new TimerCreateWFPa();
                    TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                    time_set.Time_start  = "wf_create";
                    time_set.Exact_time  = "";
                    time_set.Offset_time = (DateTime.Now.AddDays(5) - DateTime.Now).ToString();
                    //time_set.Offset_time = (DateTime.Now.AddMinutes(3) - DateTime.Now).ToString();
                    time_set.Action    = "INVILID";
                    time_set.Call_back = "http://localhost/CallBack/testCallBack";
                    TCP.AppendTimer("PqAssess", time_set);

                    //创建写入timeout属性的工作流
                    CWorkFlow wf = new CWorkFlow();

                    wf.InstFromXmlNode(m_workFlow.WriteToXmlNode());

                    //修改定时器
                    foreach (var ti in TCP.wf_timer)
                    {
                        try
                        {
                            DateTime?dt = null;

                            if (ti.Value["ExactTime"] != "")
                            {
                                dt = DateTime.Parse(ti.Value["ExactTime"]);
                            }
                            wf.events[ti.Key].TimeOutProperty.SetAttribute("exact_time", dt);

                            TimeSpan?ts = null;
                            if (ti.Value["OffsetTime"] != "")
                            {
                                ts = TimeSpan.Parse(ti.Value["OffsetTime"]);
                            }
                            wf.events[ti.Key].TimeOutProperty.SetAttribute("offset_time", ts);

                            wf.events[ti.Key].TimeOutProperty.SetAttribute("time_start", ti.Value["TimeStart"]);

                            wf.events[ti.Key].TimeOutProperty.SetAttribute("action", ti.Value["Action"]);
                            wf.events[ti.Key].TimeOutProperty.SetAttribute("call_back", ti.Value["CallBack"]);
                        }
                        catch
                        {
                            continue;
                        }
                    }

                    //创建工作流
                    wf.CreateEntityBySelf();
                    //开启工作流
                    Dictionary <string, string> record = new Dictionary <string, string>();
                    record.Add("username", "system_temporary");
                    record.Add("time", DateTime.Now.ToString());
                    TCP.wf_record = record;
                    wf.Start((IDictionary <string, string>)(TCP.wf_record));


                    Dictionary <string, string> signal = new Dictionary <string, string>();
                    string Equip_Code           = T.Equip_Code;
                    int    Equip_location_EA_Id = tm.getEA_id_byCode(Equip_Code);

                    signal["Zz_Name"]           = tm.getZzName(Equip_location_EA_Id);
                    signal["Equip_GyCode"]      = T.Equip_GyCode;
                    signal["Equip_Code"]        = T.Equip_Code;
                    signal["Equip_ABCMark"]     = T.Equip_ABCMark;
                    signal["SubmitJxPlan_Done"] = "true";
                    //record
                    Dictionary <string, string> record1 = new Dictionary <string, string>();
                    record1["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                    record1["time"]     = DateTime.Now.ToString();
                    //submit
                    CWFEngine.SubmitSignal(Convert.ToInt32(wf.EntityID), signal, record1);
                }
            }
            catch (Exception e)
            {
                return("");
            }
            return("/A14dot3/Index");
        }