Exemplo n.º 1
0
        public DTOResponse SetP01(
            LocationStnRequest request,
            IDbConnection db,
            IDbTransaction trans)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                LocStationInfoEntity stationinfoEntity = db.Single <LocStationInfoEntity>(x => x.STATIONNO == request.STATIONNO);
                if (stationinfoEntity != null)
                {
                    //如果是紧急出口EMEXIT==1,0==正常出口,不允许分配
                    if (stationinfoEntity.EMEXIT == 1)
                    {
                        throw new Exception("紧急出口,不允许分配!");
                    }

                    stationinfoEntity.LOCATIONX   = request.LOCATIONX;
                    stationinfoEntity.PRIORITY    = request.PRIORITY;
                    stationinfoEntity.TASKCOUNT   = request.TASKCOUNT;
                    stationinfoEntity.P03         = request.P03;
                    stationinfoEntity.P04         = request.P04;
                    stationinfoEntity.OPBY        = SysInfo.CurrentUserName;
                    stationinfoEntity.OPDATE      = Utils.GetTodayNow();
                    stationinfoEntity.OPMESSAGE   = "设置站台参数!";
                    stationinfoEntity.CONTROLMODE = new Decimal?((Decimal)request.CONTROLMODE);

                    SqlExpression <LocStationInfoEntity> sqlExpression = db.From <LocStationInfoEntity>();
                    sqlExpression.Where(x => x.ID == stationinfoEntity.ID);
                    sqlExpression.UpdateFields.Add("LOCATIONX");
                    sqlExpression.UpdateFields.Add("PRIORITY");
                    sqlExpression.UpdateFields.Add("TASKCOUNT");
                    sqlExpression.UpdateFields.Add("P03");
                    sqlExpression.UpdateFields.Add("P04");

                    sqlExpression.UpdateFields.Add("OPBY");
                    sqlExpression.UpdateFields.Add("OPDATE");
                    sqlExpression.UpdateFields.Add("OPMESSAGE");
                    sqlExpression.UpdateFields.Add("CONTROLMODE");

                    db.UpdateOnly <LocStationInfoEntity>(stationinfoEntity, sqlExpression);
                }
                SysAlterInfoService.InsertAlterInfo("1", request.STATIONNO + "设置站台参数:" + request.ToJson(), "1");
                dtoResponse.ResultObject = (object)new List <LocStationInfoEntity>()
                {
                    stationinfoEntity
                };
                dtoResponse.IsSuccess   = true;
                dtoResponse.MessageText = "操作成功!";
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Exemplo n.º 2
0
        public DTOResponse SetP01Emplty(
            LocationStnRequest request,
            IDbConnection db,
            IDbTransaction trans)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                LocStationInfoEntity stationinfoEntity = db.Single <LocStationInfoEntity>(x => x.STATIONNO == request.STATIONNO);
                if (stationinfoEntity != null)
                {
                    stationinfoEntity.WORNO       = (string)null;
                    stationinfoEntity.WORLINE     = (string)null;
                    stationinfoEntity.WORSTATE    = (string)null;
                    stationinfoEntity.OPBY        = SysInfo.CurrentUserName;
                    stationinfoEntity.OPDATE      = Utils.GetTodayNow();
                    stationinfoEntity.OPMESSAGE   = "清空工单设置";
                    stationinfoEntity.CONTROLMODE = new Decimal?(new Decimal());
                    stationinfoEntity.ISCLOSE     = 0;

                    SqlExpression <LocStationInfoEntity> sqlExpression = db.From <LocStationInfoEntity>();
                    sqlExpression.Where(x => x.ID == stationinfoEntity.ID);
                    sqlExpression.UpdateFields.Add("WORNO");
                    sqlExpression.UpdateFields.Add("WORLINE");
                    sqlExpression.UpdateFields.Add("WORSTATE");

                    sqlExpression.UpdateFields.Add("OPBY");
                    sqlExpression.UpdateFields.Add("OPDATE");
                    sqlExpression.UpdateFields.Add("OPMESSAGE");
                    sqlExpression.UpdateFields.Add("CONTROLMODE");
                    sqlExpression.UpdateFields.Add("ISCLOSE");

                    db.UpdateOnly <LocStationInfoEntity>(stationinfoEntity, sqlExpression);
                }
                SysAlterInfoService.InsertAlterInfo("1", request.STATIONNO + "清空工单设置", "1");
                dtoResponse.ResultObject = (object)new List <LocStationInfoEntity>()
                {
                    stationinfoEntity
                };
                dtoResponse.IsSuccess   = true;
                dtoResponse.MessageText = "操作成功!";
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Exemplo n.º 3
0
        public DTOResponse UpdateEquipmentStatus()
        {
            DTOResponse    dtoResponse = new DTOResponse();
            IDbConnection  dbCon       = (IDbConnection)null;
            IDbTransaction dbTrans     = (IDbTransaction)null;

            try
            {
                object obj = HelperDbOperation.ExecuteScalar("SELECT ID FROM PROJ_ULDSCENE WHERE SCENESTATE=1");
                HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans);
                List <INF_EQUIPMENTSTATUSEntity> equipmentstatusEntityList = dbCon.Select <INF_EQUIPMENTSTATUSEntity>((Expression <Func <INF_EQUIPMENTSTATUSEntity, bool> >)(x => x.WMSLOCNUM == "none" && x.STATUS == 0));
                foreach (INF_EQUIPMENTSTATUSEntity equipmentstatusEntity in equipmentstatusEntityList)
                {
                    if (equipmentstatusEntity.EQUIPMENTSTATUS == "1")
                    {
                        string str1     = "0";
                        string str2     = "故障代码:" + equipmentstatusEntity.EQUIPMENTSTATUS;
                        string todayNow = Utils.GetTodayNow();
                        string sql1     = string.Format("UPDATE PROJ_LOCATION_DETAIL SET LOCATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLID='{0}'", (object)equipmentstatusEntity.EQUIPMENTID, (object)str1, (object)str2, (object)todayNow);
                        int    num1     = dbCon.ExecuteSql(sql1);
                        string sql2     = (string)null;
                        int    num2     = 0;
                        string sql3     = (string)null;
                        int    num3     = 0;
                        int    num4     = 0;
                        if (Convert.ToInt32(obj) < 100)
                        {
                            sql2 = string.Format("UPDATE PROJ_STATIONINFO SET STATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLNO IN (SELECT GROUPNO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}')", (object)equipmentstatusEntity.EQUIPMENTID, (object)"1", (object)str2, (object)todayNow);
                            num2 = dbCon.ExecuteSql(sql2);
                            sql3 = string.Format("UPDATE PROJ_STATIONINFO SET STATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLNO IN (SELECT AREANO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}')", (object)equipmentstatusEntity.EQUIPMENTID, (object)"1", (object)str2, (object)todayNow);
                            num3 = dbCon.ExecuteSql(sql3);
                            if (SysParamsService.CheckPrarams("StationErrorUpdateRelate").ToLower() == "true")
                            {
                                string sql4 = string.Format("UPDATE PROJ_STATIONINFO SET ISCLOSE={1} WHERE STATIONNO IN ( SELECT RELATENO FROM PROJ_STATIONRELATE WHERE STATIONNO IN ( SELECT AREANO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}'))", (object)equipmentstatusEntity.EQUIPMENTID, (object)0);
                                num4 = dbCon.ExecuteSql(sql4);
                            }
                        }
                        DCSInfService.logger.Info((object)sql2);
                        DCSInfService.logger.Info((object)sql3);
                        DCSInfService.logger.Info((object)(equipmentstatusEntity.EQUIPMENTID + ":" + num1.ToString() + "/" + num2.ToString() + "/" + num3.ToString() + " " + str2));
                        SysAlterInfoService.InsertAlterInfo("2", equipmentstatusEntity.EQUIPMENTID + "故障恢复!" + str2, "1");
                    }
                    else
                    {
                        string str1     = "error";
                        string str2     = "故障代码:" + equipmentstatusEntity.EQUIPMENTSTATUS;
                        string todayNow = Utils.GetTodayNow();
                        string sql1     = string.Format("UPDATE PROJ_LOCATION_DETAIL SET LOCATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLID='{0}'", (object)equipmentstatusEntity.EQUIPMENTID, (object)str1, (object)str2, (object)todayNow);
                        int    num1     = dbCon.ExecuteSql(sql1);
                        string sql2     = (string)null;
                        int    num2     = 0;
                        string sql3     = (string)null;
                        int    num3     = 0;
                        int    num4     = 0;
                        if (Convert.ToInt32(obj) < 100)
                        {
                            sql2 = string.Format("UPDATE PROJ_STATIONINFO SET STATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLNO IN (SELECT GROUPNO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}')", (object)equipmentstatusEntity.EQUIPMENTID, (object)"0", (object)str2, (object)todayNow);
                            num2 = dbCon.ExecuteSql(sql2);
                            sql3 = string.Format("UPDATE PROJ_STATIONINFO SET STATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLNO IN (SELECT AREANO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}')", (object)equipmentstatusEntity.EQUIPMENTID, (object)"0", (object)str2, (object)todayNow);
                            num3 = dbCon.ExecuteSql(sql3);
                            if (SysParamsService.CheckPrarams("StationErrorUpdateRelate").ToLower() == "true")
                            {
                                string sql4 = string.Format("UPDATE PROJ_STATIONINFO SET ISCLOSE={1} WHERE STATIONNO IN ( SELECT RELATENO FROM PROJ_STATIONRELATE WHERE STATIONNO IN ( SELECT AREANO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}'))", (object)equipmentstatusEntity.EQUIPMENTID, (object)9);
                                num4 = dbCon.ExecuteSql(sql4);
                            }
                        }
                        DCSInfService.logger.Info((object)sql2);
                        DCSInfService.logger.Info((object)sql3);
                        DCSInfService.logger.Info((object)(equipmentstatusEntity.EQUIPMENTID + ":" + num1.ToString() + "/" + num2.ToString() + "/" + num3.ToString() + " " + str2));
                        SysAlterInfoService.InsertAlterInfo("2", equipmentstatusEntity.EQUIPMENTID + "发生故障!" + str2, "1");
                    }
                    string sql = string.Format("UPDATE INF_EQUIPMENTSTATUS SET STATUS=1,MODIFYDATE='{1}' WHERE ID='{0}'", (object)equipmentstatusEntity.ID, (object)Utils.GetDatetime());
                    dbCon.ExecuteSql(sql);
                }
                dtoResponse.IsSuccess   = true;
                dtoResponse.MessageText = "执行设备状态更新:" + equipmentstatusEntityList.Count.ToString();
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                DCSInfService.logger.Error((object)ex);
                return(dtoResponse);
            }
            finally
            {
                HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans);
            }
        }