Example #1
0
        public ResultMsg_Equ_PmFirstLevelRecord AddSecondLevelProblem(Equ_PmSecondLevelProblem dataEntity, ResultMsg_Equ_PmFirstLevelRecord result)
        {
            using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ELCO_ConnectionString"].ToString()))
            {
                SqlCommand     cmd         = new SqlCommand();
                SqlTransaction transaction = null;
                try
                {
                    conn.Open();
                    cmd.Connection = conn;
                    string strSql = "";

                    transaction     = conn.BeginTransaction();
                    cmd.Transaction = transaction;

                    strSql = string.Format(
                        @" INSERT INTO Equ_SecondLevelInspectionProblem  
                    (  InspectionProblem, InspectionDate,DeviceCode,MaintenceTime,PowerLine,GroundLead,ReplacePart,ReplaceName,ReplaceCount)VALUES (
                      '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')",
                        dataEntity.InspectionProblem,
                        dataEntity.PmDate,
                        dataEntity.DeviceCode,
                        dataEntity.MaintenceTime,
                        dataEntity.PowerLine,
                        dataEntity.GroundLead,
                        dataEntity.ReplacePart,
                        dataEntity.ReplaceName,
                        dataEntity.ReplaceCount
                        );
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = strSql;
                    cmd.ExecuteNonQuery();
                    transaction.Commit();
                    result.result = "success";
                    result.msg    = "保存数据成功!";
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    result.result = "failed";
                    result.msg    = "保存失败! \n" + ex.Message;
                }
            }
            return(result);
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (context.Session["UserName"] != null)
            {
                UserName = context.Session["UserName"].ToString().ToUpper().Trim();
            }
            else
            {
                UserName = "";
            }

            Action = RequstString("Action");

            if (Action.Length == 0)
            {
                Action = "";
            }

            if (Action == "EquMaintenceExtraMan_Detail" || Action == "EquMaintenceMan_DetailFinish")
            {
                Equ_PmRecordInfo equinfo = new Equ_PmRecordInfo();
                equinfo.ID = RequstString("EquID");
                Equ_PmRecordInfo result = new Equ_PmRecordInfo();
                result = GetEquPmRecordDetailObj(equinfo, result);
                context.Response.Write(jsc.Serialize(result));
            }
            else if (Action == "EquMaintenceExtraMan_Edit")
            {
                Equ_PmRecordInfo dataEntity = new Equ_PmRecordInfo();
                dataEntity.ID           = RequstString("EquID");
                dataEntity.ProcessCode  = RequstString("ProcessName");
                dataEntity.DeviceName   = RequstString("DeviceName");
                dataEntity.PmSpecName   = RequstString("PmSpecName");
                dataEntity.PmStartDate  = RequstString("PmStartDate");
                dataEntity.PmFinishDate = RequstString("PmFinishDate");
                dataEntity.PmOper       = RequstString("PmOper");
                dataEntity.PmComment    = RequstString("PmComment");

                ResultMsg_Equ_PmRecord result = new ResultMsg_Equ_PmRecord();
                result = editEquMaintenceExtraManDataInDB(dataEntity, result);
                context.Response.Write(jsc.Serialize(result));
            }
            else if (Action == "EquMaintenceExtraMan_Add")
            {
                Equ_PmRecordInfo dataEntity = new Equ_PmRecordInfo();
                //dataEntity.ID = RequstString("ProcId");
                dataEntity.ProcessCode  = RequstString("ProcessName");
                dataEntity.DeviceName   = RequstString("DeviceName");
                dataEntity.PmType       = RequstString("PmType");
                dataEntity.PmSpecName   = RequstString("PmSpecName");
                dataEntity.PmStartDate  = RequstString("PmStartDate");
                dataEntity.PmFinishDate = RequstString("PmFinishDate");
                dataEntity.PmComment    = RequstString("PmComment");
                dataEntity.PmOper       = RequstString("PmOper");

                ResultMsg_Equ_PmRecord result = new ResultMsg_Equ_PmRecord();
                result = addEquMaintenceExtraManDataInDB(dataEntity, result);
                context.Response.Write(jsc.Serialize(result));
            }

            else if (Action == "EquMaintenceMan_DetailUnFinish")
            {
                Equ_PmRecordInfo equinfo = new Equ_PmRecordInfo();
                equinfo.ID = RequstString("EquID");
                Equ_PmRecordInfo result = new Equ_PmRecordInfo();
                result = GetEquPmUnFinishRecordDetailObj(equinfo, result);
                context.Response.Write(jsc.Serialize(result));
            }

            else if (Action == "ExcuteEquMaintenceMan")
            {
                Equ_PmRecordInfo dataEntity = new Equ_PmRecordInfo();
                //dataEntity.ID = RequstString("EquID");
                dataEntity.ProcessCode  = RequstString("ProcessName");
                dataEntity.DeviceName   = RequstString("DeviceName");
                dataEntity.PmSpecName   = RequstString("PmSpecName");
                dataEntity.PmPlanName   = RequstString("PmPlanName");
                dataEntity.PmType       = "计划内保养";
                dataEntity.PmSpecName   = RequstString("PmSpecName");
                dataEntity.PmStartDate  = RequstString("PmStartDate");
                dataEntity.PmFinishDate = RequstString("PmFinishDate");
                dataEntity.PmComment    = RequstString("PmComment");
                dataEntity.PmOper       = RequstString("PmOper");

                ResultMsg_Equ_PmRecord result = new ResultMsg_Equ_PmRecord();
                result = ExcuteEquMaintenceManDataInDB(dataEntity, result);
                context.Response.Write(jsc.Serialize(result));
            }

            else if (Action == "EquMaintenceManEdit")
            {
                Equ_PmRecordInfo dataEntity = new Equ_PmRecordInfo();
                dataEntity.ID = RequstString("EquID");
                //dataEntity.ProcessCode = RequstString("ProcessName");
                //dataEntity.DeviceName = RequstString("DeviceName");
                //dataEntity.PmSpecName = RequstString("PmSpecName");
                //dataEntity.PmPlanName = RequstString("PmPlanName");
                //dataEntity.PmType = "计划内保养";
                //dataEntity.PmSpecName = RequstString("PmSpecName");
                dataEntity.PmStartDate  = RequstString("PmStartDate");
                dataEntity.PmFinishDate = RequstString("PmFinishDate");
                dataEntity.PmComment    = RequstString("PmComment");
                dataEntity.PmOper       = RequstString("PmOper");

                ResultMsg_Equ_PmRecord result = new ResultMsg_Equ_PmRecord();
                result = editEquMaintenceManDataInDB(dataEntity, result);
                context.Response.Write(jsc.Serialize(result));
            }

            else if (Action == "ExcuteFirstLevelEquMaintenceMan")
            {
                List <Equ_PmFisrtLevelRecordInfo> dataEntity = new List <Equ_PmFisrtLevelRecordInfo>();
                string[] PmList = RequstString("PmList").Split(',');

                for (int i = 0; i < PmList.Length; i++)
                {
                    Equ_PmFisrtLevelRecordInfo ep = new Equ_PmFisrtLevelRecordInfo();
                    ep.PmPlanCode = PmList[i].ToString();

                    ep.PmComment = RequstString("PmComment");
                    ep.PmOper    = RequstString("PmOper");

                    ep.FindProblem   = RequstString("FindProblem") == "" ? 0 : Convert.ToInt16(RequstString("FindProblem"));
                    ep.RepairProblem = RequstString("RepairProblem") == "" ? 0 : Convert.ToInt16(RequstString("RepairProblem"));
                    ep.ReaminProblem = RequstString("ReaminProblem") == "" ? 0 : Convert.ToInt16(RequstString("ReaminProblem"));
                    dataEntity.Add(ep);
                }

                ResultMsg_Equ_PmFirstLevelRecord result = new ResultMsg_Equ_PmFirstLevelRecord();
                result = ExcuteFirstLevelEquMaintenceMan(dataEntity, result);
                context.Response.Write(jsc.Serialize(result));
            }

            else if (Action == "ExcuteSecondLevelEquMaintenceMan")
            {
                List <Equ_PmFisrtLevelRecordInfo> dataEntity = new List <Equ_PmFisrtLevelRecordInfo>();
                string[] PmList = RequstString("PmList").Split(',');

                for (int i = 0; i < PmList.Length; i++)
                {
                    Equ_PmFisrtLevelRecordInfo ep = new Equ_PmFisrtLevelRecordInfo();
                    ep.PmPlanCode = PmList[i].ToString();
                    ep.PmOper     = RequstString("PmOper");
                    dataEntity.Add(ep);
                }

                ResultMsg_Equ_PmFirstLevelRecord result = new ResultMsg_Equ_PmFirstLevelRecord();
                result = ExcuteSecondLevelEquMaintenceMan(dataEntity, result);
                context.Response.Write(jsc.Serialize(result));
            }

            else if (Action == "CheckFirstLevelMaintence")
            {
                ResultMsg_Equ_PmFirstLevelRecord result = new ResultMsg_Equ_PmFirstLevelRecord();
                result = CheckFirstLevelMaintence(result);
                context.Response.Write(jsc.Serialize(result));
            }

            else if (Action == "EquFirstLevelMaintenceMan_Detail")
            {
                Equ_PmFisrtLevelRecordDetail result = new Equ_PmFisrtLevelRecordDetail();
                result.ID = RequstString("EquID");
                result    = GetFirstLevelDetail(result);
                context.Response.Write(jsc.Serialize(result));
            }

            else if (Action == "AddSecondLevelProblem")
            {
                Equ_PmSecondLevelProblem dataEntity = new Equ_PmSecondLevelProblem();
                //dataEntity.ID = RequstString("EquID");
                dataEntity.PmOper            = RequstString("PmOper");
                dataEntity.PmDate            = RequstString("PmDate");
                dataEntity.DeviceCode        = RequstString("DeviceCode");
                dataEntity.MaintenceTime     = RequstString("MaintenceTime");
                dataEntity.PowerLine         = RequstString("PowerLine");
                dataEntity.GroundLead        = RequstString("GroundLead");
                dataEntity.ReplacePart       = RequstString("ReplacePart");
                dataEntity.ReplaceName       = RequstString("ReplaceName");
                dataEntity.ReplaceCount      = RequstString("ReplaceCount");
                dataEntity.InspectionProblem = RequstString("InspectionProblem");

                ResultMsg_Equ_PmFirstLevelRecord result = new ResultMsg_Equ_PmFirstLevelRecord();
                result = AddSecondLevelProblem(dataEntity, result);
                context.Response.Write(jsc.Serialize(result));
            }

            #region//获取每日保养用时
            if (Action == "GetDailyMaintenceTime")
            {
                Model.DailyMaintenceTime mb = new Model.DailyMaintenceTime();
                mb.MaintenceDate = RequstString("CurrentMonth");
                mb = GetDailyMaintenceTime(mb);
                context.Response.Write(jsc.Serialize(mb));
            }
            #endregion
            #region //新增每日保养用时
            if (Action == "DailyMaintenceTime_Add")
            {
                Model.DailyMaintenceTime mb = new Model.DailyMaintenceTime();
                mb.MaintenceDate = RequstString("CurrentTime");
                mb.TotalTime     = RequstString("TotalTime");
                Model.ResultMsg_DailyMaintenceTime result = new ResultMsg_DailyMaintenceTime();
                result = DailyMaintenceTimeAdd(mb, result);
                context.Response.Write(jsc.Serialize(result));
            }
            #endregion
            #region //更新每日保养用时
            if (Action == "DailyMaintenceTime_Edit")
            {
                Model.DailyMaintenceTime mb = new Model.DailyMaintenceTime();
                mb.MaintenceDate = RequstString("CurrentMonth");
                mb.TotalTime     = RequstString("TotalTime");
                Model.ResultMsg_DailyMaintenceTime result = new Model.ResultMsg_DailyMaintenceTime();
                result = DailyMaintenceTimeEdit(mb, result);
                context.Response.Write(jsc.Serialize(result));
            }
            #endregion
        }