Exemple #1
0
        public DTOResponse CreateTaskByMen(MoveRequest request)
        {
            DTOResponse    dtoResponse = new DTOResponse();
            IDbConnection  dbCon       = (IDbConnection)null;
            IDbTransaction dbTrans     = (IDbTransaction)null;

            try
            {
                HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans);
                dtoResponse = this.CreateTaskByMen(request, dbCon, dbTrans);
                LogService.logger.Info((object)dtoResponse.ToString());
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                LogService.logger.Error((object)ex);
                return(dtoResponse);
            }
            finally
            {
                HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans);
            }
        }
Exemple #2
0
        /// <summary>
        /// 确认重置站台设置信息
        /// </summary>
        public DTOResponse RestChanelStorestate(MoveRequest request)
        {
            DTOResponse    dtoResponse = new DTOResponse();
            IDbConnection  dbCon       = (IDbConnection)null;
            IDbTransaction dbTrans     = (IDbTransaction)null;

            try
            {
                HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans);

                string msg          = "重置站台设置信息";
                string sqlUpdateStn = string.Format(
                    @"UPDATE PROJ_STATIONINFO SET USECAPACITY=0,OPDATE='{1}',OPMESSAGE='{2}' WHERE CONTROLNO='{0}'",
                    request.StationNo, Utils.GetDatetime(), msg);
                int count1 = dbCon.ExecuteSql(sqlUpdateStn);

                dtoResponse.IsSuccess   = count1 > 0 ? true : false;
                dtoResponse.MessageText = "确认重置" + request.StationNo + "站台状态成功:" + count1 + "个工位";
                LogService.logger.Info((object)dtoResponse.ToString());
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                LogService.logger.Error((object)ex);
                return(dtoResponse);
            }
            finally
            {
                HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans);
            }
        }
        public DTOResponse OrderSenceMode(SceneRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConnection = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    using (IDbTransaction trans = dbConnection.OpenTransaction())
                    {
                        dtoResponse = this.OrderSenceMode(request, dbConnection, trans);
                        if (dtoResponse.IsSuccess)
                        {
                            trans.Commit();
                        }
                        else
                        {
                            trans.Rollback();
                        }
                        SysSceneService.logger.Info((object)dtoResponse.ToString());
                        return(dtoResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                SysSceneService.logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Exemple #4
0
 public static void InsertOplog(DTOResponse dtoResponse, string keyValue = "")
 {
     try
     {
         SysOplogEntity oplog = new SysOplogEntity();
         oplog.CREATEDATE = System.DateTime.Now;
         oplog.ENTERDATE  = Utils.GetDatetime();
         oplog.KEYVALUE   = keyValue;
         oplog.OPMESSAGE  = dtoResponse.ToString();
         using (IDbConnection dbCon = HelperConnection.GetConnectionFactory().OpenDbConnection())
         {
             dbCon.Insert <SysOplogEntity>(oplog);
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message, ex);
     }
 }
Exemple #5
0
        protected DTOResponse CreateTaskByMen(
            MoveRequest request,
            IDbConnection dbCon,
            IDbTransaction dbTrans)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                if (string.IsNullOrEmpty(request.StationNo))
                {
                    throw new Exception("参数不正确!@StationNo");
                }
                if (string.IsNullOrEmpty(request.Destination))
                {
                    throw new Exception("参数不正确!@Destination");
                }

                LocStationInfoEntity locStation1 = dbCon.Single <LocStationInfoEntity>(x => x.CONTROLNO == request.StationNo);
                if (locStation1 == null)
                {
                    throw new Exception(string.Format("站台:{0}不存在!", request.StationNo));
                }

                LocStationInfoEntity locStation2 = dbCon.Single <LocStationInfoEntity>(x => x.CONTROLNO == request.Destination);
                if (locStation2 == null)
                {
                    throw new Exception(string.Format("站台:{0}不存在!", request.Destination));
                }

                if (string.IsNullOrEmpty(request.PalletNo))
                {
                    request.PalletNo = "0";
                }
                if (string.IsNullOrEmpty(request.PalletType))
                {
                    request.PalletType = "1";
                }
                if (request.Priority < 1)
                {
                    request.Priority = 1;
                }

                SysSequenceResult sysSequence = SysSequenceInstance.Instance().GetSysSequence("TASKID");
                TaskEntity        taskEntity  = new TaskEntity()
                {
                    TASKNO          = long.Parse(sysSequence.SEQVALUE).ToString(),
                    TASKDATE        = Utils.GetToday(),
                    TASKTCLASS      = "3",
                    TASKTYPE        = "0",
                    PRIORITY        = request.Priority,
                    TASKGROUPNO     = "",
                    PRETASKNO       = "",
                    STRATEGYID01    = "",
                    STRATEGYNAME01  = "",
                    SOURCEAREA      = locStation1.GROUPNO,
                    SOURCE01        = locStation1.STATIONNO,
                    SOURCE02        = locStation1.CONTROLNO,
                    STRATEGYID02    = "",
                    STRATEGYNAME02  = "",
                    DESTINATIONAREA = locStation2.GROUPNO,
                    DESTINATION01   = locStation2.STATIONNO,
                    DESTINATION02   = locStation2.CONTROLNO,
                    TASKORDERDATA   = "",
                    CREATEDATE      = Utils.GetTodayNow(),
                    CREATEBY        = SysInfo.CurrentUserName,
                    STARTDATE       = "",
                    ENDDATE         = "",
                    CANCELDATE      = "",
                    CANCELREASON    = "",
                    TASKSTATE       = "0",
                    BILLID          = "0",
                    BILLID_LINENUM  = 0,
                    PALLETNO        = request.PalletNo,
                    PALLETTYPE      = request.PalletType
                };
                taskEntity.TASKDESC = string.Format("人工任务:从{0}到{1}", taskEntity.SOURCE02, taskEntity.DESTINATION02);
                long num = dbCon.Insert <TaskEntity>(taskEntity, false);

                dtoResponse.MessageText = "任务号:" + taskEntity.TASKNO + "容器编号:" + request.PalletNo + "从" + locStation1.CONTROLNO + "到" + locStation2.CONTROLNO;
                dtoResponse.IsSuccess   = num == 1 ? true : false;
                LogService.logger.Info((object)dtoResponse.ToString());
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                LogService.logger.Error((object)ex);
                return(dtoResponse);
            }
        }
        public DTOResponse OrderSenceMode(
            SceneRequest request,
            IDbConnection db,
            IDbTransaction trans)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                SysSceneEntity uldScene1 = OrmLiteReadExpressionsApi.Single <SysSceneEntity>(db, (Expression <Func <SysSceneEntity, bool> >)(x => x.ID == request.ID || x.SCENENO == request.SCENENO));
                if (uldScene1 == null)
                {
                    throw new Exception("获取场景为空!");
                }
                if (uldScene1.SCENENO != request.SCENENO)
                {
                    throw new Exception("传入的参数与后台不一致!");
                }
                if (uldScene1.USESTATE != 1)
                {
                    throw new Exception("当前模式" + uldScene1.SCENENO + "管理员未启用!请联系管理员!");
                }
                INF_JOBDOWNLOADEntity jobdownloadEntity1 = new INF_JOBDOWNLOADEntity();
                jobdownloadEntity1.ID      = Utils.GetDateTimeGuid();
                jobdownloadEntity1.GROUPID = "0";
                //jobdownloadEntity1.JOBID = uldScene1.P01;
                //jobdownloadEntity1.EQUIPMENTID = uldScene1.P02;
                jobdownloadEntity1.WAREHOUSEID = "none";
                jobdownloadEntity1.JOBTYPE     = 4;
                jobdownloadEntity1.ORDERTYPE   = 0;
                jobdownloadEntity1.SOURCE      = "0";
                //jobdownloadEntity1.TARGET = uldScene1.P02;
                jobdownloadEntity1.BRANDID  = "0";
                jobdownloadEntity1.PLANQTY  = new Decimal?(new Decimal());
                jobdownloadEntity1.PILETYPE = "0";
                jobdownloadEntity1.PRIORITY = 1;
                jobdownloadEntity1.BARCODE  = "0";
                int    id   = uldScene1.ID;
                string str1 = id.ToString();
                jobdownloadEntity1.TUTYPE         = str1;
                jobdownloadEntity1.ENTERDATE      = Utils.GetTodayNow();
                jobdownloadEntity1.RESPONDDATE    = (string)null;
                jobdownloadEntity1.RESPONDCOUNT   = 1;
                jobdownloadEntity1.RESPONDMSG     = "";
                jobdownloadEntity1.STATUS         = 0;
                jobdownloadEntity1.WEIGHT         = new Decimal?(new Decimal());
                jobdownloadEntity1.FULLCOUNT      = 0;
                jobdownloadEntity1.EXTENDINFO     = "";
                jobdownloadEntity1.EXTATTR1       = "";
                jobdownloadEntity1.EXTATTR2       = "";
                jobdownloadEntity1.EXTATTR3       = "";
                jobdownloadEntity1.CREATEDATE     = Utils.GetTodayNow();
                jobdownloadEntity1.CREATEUSERID   = SysInfo.CurrentUserID;
                jobdownloadEntity1.CREATEUSERNAME = SysInfo.CurrentUserName;
                string emergencyexit = uldScene1.EMERGENCYEXIT;
                if (!string.IsNullOrEmpty(emergencyexit))
                {
                    string str2    = emergencyexit;
                    char[] chArray = new char[1] {
                        ','
                    };
                    foreach (string str3 in str2.Split(chArray))
                    {
                        string          item = str3;
                        LocDetailEntity locationDetailEntity = OrmLiteReadExpressionsApi.Single <LocDetailEntity>(db, (Expression <Func <LocDetailEntity, bool> >)(x => x.GROUPNO == item));
                        if (locationDetailEntity != null)
                        {
                            locationDetailEntity.EMEXIT = "1";
                            db.UpdateOnly <LocDetailEntity>(locationDetailEntity, (Expression <Func <LocDetailEntity, object> >)(x => new
                            {
                                EMEXIT = x.EMEXIT
                            }), (Expression <Func <LocDetailEntity, bool> >)null, (Action <IDbCommand>)null);
                        }
                    }
                }
                uldScene1.SCENESTATE = "1";
                uldScene1.OPBY       = SysInfo.CurrentUserName;
                uldScene1.OPDATE     = Utils.GetTodayNow();
                SysSceneEntity uldScene2 = uldScene1;
                id = uldScene1.ID;
                string str4 = "下达" + id.ToString() + "操作成功!";
                uldScene2.OPMESSAGE = str4;
                // uldScene1.P10 = jobdownloadEntity1.ID;
                string sql  = string.Format("UPDATE PROJ_ULDSCENE SET SCENESTATE='0',OPBY='{1}',OPDATE='{2}',OPMESSAGE='{3}' WHERE ID<>{0}", (object)uldScene1.ID, (object)SysInfo.CurrentUserName, (object)Utils.GetTodayNow(), (object)"场景切换");
                long   num1 = 0;
                //num1 = (long)db.SaveAll<INF_JOBDOWNLOADEntity>((IEnumerable<INF_JOBDOWNLOADEntity>)new List<INF_JOBDOWNLOADEntity>()
                //{
                //  jobdownloadEntity1
                //});
                int num2 = db.Update <SysSceneEntity>(uldScene1, (Action <IDbCommand>)null);
                int num3 = db.ExecuteSql(sql);
                dtoResponse.IsSuccess   = true;
                dtoResponse.MessageText = "下达操作成功!" + num1.ToString() + "/" + num2.ToString() + "/" + num3.ToString();
                SysSceneService.logger.Info((object)dtoResponse.ToString());
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                SysSceneService.logger.Error((object)ex);
                return(dtoResponse);
            }
        }