コード例 #1
0
        /// <summary>
        /// 删除队列清单
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public ActionResult DeleteQueueList(int ids)
        {
            CWTask   cwtask = new CWTask();
            Response rsp    = new CWTask().ManualDeleteQueue(ids);

            return(Content(rsp.Message));
        }
コード例 #2
0
        // GET: ExternalManager/External
        public ActionResult GetCurrentSound()
        {
            Log log = LogFactory.GetLogger("GetCurrentSound");

            try
            {
                string wh   = Request.QueryString["warehouse"];
                string code = Request.QueryString["devicecode"];

                if (string.IsNullOrEmpty(wh) ||
                    string.IsNullOrEmpty(code))
                {
                    log.Error("传输出现错误,参数为空!");
                    return(Content("null"));
                }
                int warehouse  = Convert.ToInt32(wh);
                int devicecode = Convert.ToInt32(code);

                string sound = new CWTask().GetNotification(warehouse, devicecode);
                return(Content(sound));
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
            return(Content("null"));
        }
コード例 #3
0
        /// <summary>
        /// 获取有作业的设备信息
        /// </summary>
        /// <returns></returns>
        public async Task <JsonResult> GetDeviceTaskLst()
        {
            List <DeviceTaskDetail> detailLst = new List <DeviceTaskDetail>();

            List <Device> hasTask = await new CWDevice().FindListAsync(dv => dv.TaskID != 0);
            CWTask        cwtask  = new CWTask();

            foreach (Device dev in hasTask)
            {
                ImplementTask itask = await cwtask.FindAsync(dev.TaskID);

                if (itask != null)
                {
                    string           desp   = dev.Warehouse.ToString() + dev.DeviceCode.ToString();
                    string           type   = PlusCvt.ConvertTaskType(itask.Type);
                    string           status = PlusCvt.ConvertTaskStatus(itask.Status, itask.SendStatusDetail);
                    DeviceTaskDetail detail = new DeviceTaskDetail
                    {
                        DevDescp = desp,
                        TaskType = type,
                        Status   = status,
                        Proof    = itask.ICCardCode
                    };
                    detailLst.Add(detail);
                }
            }

            return(Json(detailLst, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tID"></param>
        /// <returns></returns>
        public ActionResult GetTaskDetailByID(int ID)
        {
            ImplementTask itask = new CWTask().Find(tsk => tsk.ID == ID);
            DisplayITask  dtask = new DisplayITask();

            if (itask != null)
            {
                dtask = new DisplayITask
                {
                    ID               = itask.ID,
                    Warehouse        = itask.Warehouse,
                    DeviceCode       = itask.DeviceCode,
                    Type             = PlusCvt.ConvertTaskType(itask.Type),
                    Status           = PlusCvt.ConvertTaskStatus(itask.Status, itask.SendStatusDetail),
                    SendStatusDetail = PlusCvt.ConvertSendStateDetail(itask.SendStatusDetail),
                    CreateDate       = itask.CreateDate.ToString(),
                    SendDtime        = itask.SendDtime.ToString(),
                    HallCode         = itask.HallCode,
                    FromLctAddress   = itask.FromLctAddress,
                    ToLctAddress     = itask.ToLctAddress,
                    ICCardCode       = itask.ICCardCode,
                    Distance         = itask.Distance,
                    CarSize          = itask.CarSize,
                    CarWeight        = itask.CarWeight
                };
            }
            return(Json(dtask, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public ContentResult CreateDeviceTaskByQueue()
        {
            try
            {
                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.Default.GetString(bytes);

                JObject jo = (JObject)JsonConvert.DeserializeObject(req);

                string queueID = jo["queueID"].ToString();
                string wh      = jo["warehouse"].ToString();
                string code    = jo["devicecode"].ToString();

                int queueid = Convert.ToInt32(queueID);

                int warehouse  = Convert.ToInt32(wh);
                int devicecode = Convert.ToInt32(code);

                Response resp = new CWTask().CreateDeviceTaskByQueue(warehouse, queueid, devicecode);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            return(Content("success"));
        }
コード例 #6
0
        public JsonResult FindQueueList(int?pageSize, int?pageIndex, string warehouse, string code)
        {
            CWTask          cwtask = new CWTask();
            Page <WorkTask> page   = new Page <WorkTask>();

            if (pageSize != null)
            {
                page.PageSize = (int)pageSize;
            }
            if (pageIndex != null)
            {
                page.PageIndex = (int)pageIndex;
            }
            if ((!string.IsNullOrEmpty(warehouse) && warehouse != "0") &&
                (!string.IsNullOrEmpty(code) && code != "0"))
            {
                int wh  = Convert.ToInt32(warehouse);
                int smg = Convert.ToInt32(code);
                page = cwtask.FindPagelist(page, (wtsk => wtsk.Warehouse == wh && wtsk.DeviceCode == smg), null);
                var data = new
                {
                    total = page.TotalNumber,
                    rows  = page.ItemLists
                };
                return(Json(data));
            }
            page = cwtask.FindPageList(page, null);
            var value = new
            {
                total = page.TotalNumber,
                rows  = page.ItemLists
            };

            return(Json(value));
        }
コード例 #7
0
        public async Task <ContentResult> UpdateTaskStatus()
        {
            try
            {
                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.Default.GetString(bytes);

                JObject jo = (JObject)JsonConvert.DeserializeObject(req);

                string tskID  = jo["taskID"].ToString();
                string status = jo["taskstatus"].ToString();

                int itaskID    = Convert.ToInt32(tskID);
                int taskstatus = Convert.ToInt32(status);

                CWTask        cwtask = new CWTask();
                ImplementTask itask  = await cwtask.FindITaskAsync(itaskID);

                Response resp = cwtask.DealUpdateTaskStatus(itask, (EnmTaskStatus)taskstatus);
                if (resp.Code == 1)
                {
                    return(Content("success"));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            return(Content("fail"));
        }
コード例 #8
0
        public async Task <JsonResult> FindITaskLst()
        {
            CWTask cwtask = new CWTask();

            List <ImplementTask> taskLst = await cwtask.FindITaskLstAsync();

            List <SubTask> subtaskLst = new List <SubTask>();

            foreach (ImplementTask itsk in taskLst)
            {
                SubTask sub = new SubTask {
                    ID               = itsk.ID,
                    Warehouse        = itsk.Warehouse,
                    DeviceCode       = itsk.DeviceCode,
                    Type             = (int)itsk.Type,
                    Status           = (int)itsk.Status,
                    SendStatusDetail = (int)itsk.SendStatusDetail,
                    SendDtime        = itsk.SendDtime.ToString(),
                    CreateDate       = itsk.CreateDate.ToString(),
                    HallCode         = itsk.HallCode,
                    FromLctAddress   = itsk.FromLctAddress,
                    ToLctAddress     = itsk.ToLctAddress,
                    ICCardCode       = itsk.ICCardCode,
                    Distance         = itsk.Distance,
                    CarSize          = itsk.CarSize,
                    CarWeight        = itsk.CarWeight,
                    IsComplete       = itsk.IsComplete,
                    LocSize          = itsk.LocSize
                };
                subtaskLst.Add(sub);
            }

            return(Json(subtaskLst));
        }
コード例 #9
0
        public async Task <ContentResult> DealTVUnloadTask()
        {
            try
            {
                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.Default.GetString(bytes);

                JObject jo = (JObject)JsonConvert.DeserializeObject(req);

                string queueID = jo["queueID"].ToString();
                string itaskID = jo["taskID"].ToString();

                int mtskID = Convert.ToInt32(queueID);
                int tid    = Convert.ToInt32(itaskID);

                CWTask   cwtask = new CWTask();
                WorkTask queue  = await cwtask.FindQueueAsync(mtskID);

                ImplementTask task = await cwtask.FindITaskAsync(tid);

                cwtask.DealTVUnloadTask(task, queue);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            return(Content("success"));
        }
コード例 #10
0
        /// <summary>
        /// 推送队列信息
        /// </summary>
        /// <param name="type"></param>
        /// <param name="entity"></param>
        private void FileWatch_WatchEvent(int type, WorkTask mtsk)
        {
            try
            {
                if (mtsk.IsMaster == 1)
                {
                    return;
                }

                #region 给LED的
                int             count   = 0;
                int             wh      = mtsk.Warehouse;
                int             hallID  = mtsk.DeviceCode;
                List <WorkTask> mtskLst = new CWTask().FindQueueList(d => d.Warehouse == wh && d.DeviceCode == hallID);
                count = mtskLst.Count;

                var data = new
                {
                    Warehouse = wh,
                    HallID    = hallID,
                    Count     = count
                };
                string jsonStr = JsonConvert.SerializeObject(data);
                //推送
                Clients.All.QueueStateToLed(jsonStr);
                #endregion
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
        }
コード例 #11
0
        public ActionResult Transport(int warehouse, string fromaddress, string toaddress)
        {
            Response resp = new CWTask().TransportLocation(warehouse, fromaddress, toaddress);

            return(Json(new ReturnModel()
            {
                code = resp.Code, message = resp.Message
            }));
        }
コード例 #12
0
        public ActionResult Move(int warehouse, int code, string address)
        {
            Response resp = new CWTask().ManualMove(warehouse, code, address);

            return(Json(new ReturnModel()
            {
                code = resp.Code, message = resp.Message
            }));
        }
コード例 #13
0
        /// <summary>
        /// 设置车厅出车类型
        /// </summary>
        /// <param name="hnmb"></param>
        /// <param name="htype"></param>
        /// <returns></returns>
        public int SetHallType(int hnmb, CSMG.EnmHallType htype)
        {
            try
            {
                CSMG smg = this.SelectSMG(hnmb);
                if (smg != null && smg.SMGType == CSMG.EnmSMGType.Hall)
                {
                    if (smg.HallType != htype)
                    {
                        CWTask wtsk = new CWTask();

                        if (htype == CSMG.EnmHallType.EnterorExit)
                        {
                            smg.HallType = htype;
                            CWData.myDB.UpdateHallType(smg.ID, htype);
                            return(0);
                        }
                        else if (htype == CSMG.EnmHallType.Entance)
                        {
                            if (wtsk.GetMasterTaskNumOfHid(hnmb, CMasterTask.EnmMasterTaskType.GetCar) == 0)
                            {
                                smg.HallType = htype;
                                CWData.myDB.UpdateHallType(smg.ID, htype);
                                return(0);
                            }
                            else
                            {
                                return(11);
                            }
                        }
                        else if (htype == CSMG.EnmHallType.Exit)
                        {
                            if (wtsk.GetMasterTaskNumOfHid(hnmb, CMasterTask.EnmMasterTaskType.SaveCar) == 0)
                            {
                                smg.HallType = htype;
                                CWData.myDB.UpdateHallType(smg.ID, htype);
                                return(0);
                            }
                            else
                            {
                                return(12);
                            }
                        }
                    }
                }
                return(0);
            }
            catch (Exception ex)
            {
                HttpRuntime.Cache.Remove("SMGs");
                throw ex;
            }
        }
コード例 #14
0
        /// <summary>
        /// 更新设备的作业ID
        /// </summary>
        /// <returns></returns>
        public int UpdateAllSMGsWorkStatus()
        {
            try
            {
                foreach (CSMG smg in SMGs)
                {
                    if (smg.nIsWorking != 0)
                    {
                        CTask tsk = new CWTask().GetCTaskFromtskID(smg.nIsWorking);
                        if (tsk == null)
                        {
                            smg.MTskID     = 0;
                            smg.nIsWorking = 0;
                            smg.NextTaskId = 0;
                            CWData.myDB.UpdateSMGTaskStat(smg);
                        }
                        //如果是移动作业,已发生过移动,则强制完成其作业
                        if (smg.SMGType == CSMG.EnmSMGType.ETV)
                        {
                            if (tsk != null)
                            {
                                if (tsk.Type == CTask.EnmTaskType.TVMove)
                                {
                                    //已经发送过了,且确认了10S过后
                                    if (tsk.StatusDetail == CTask.EnmTaskStatusDetail.Asked &&
                                        DateTime.Compare(DateTime.Now, tsk.SendDtime.AddSeconds(10)) > 0)
                                    {
                                        if (smg.Available && CheckAcceptNewCommand(smg.ID))
                                        {
                                            if (smg.CurrAddress != null && smg.CurrAddress != tsk.ToLctAdrs)
                                            {
                                                smg.nIsWorking = 0;
                                                CWData.myDB.UpdateSMGTaskStat(smg);

                                                CSysLog log = new CSysLog("0000", DateTime.Now, "强制复位移动:目标车位" + tsk.ToLctAdrs + "- 时间" + DateTime.Now, "系统");
                                                CWData.myDB.InsertSysLog(log);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                HttpRuntime.Cache.Remove("SMGs");
                throw ex;
            }
            return(0);
        }
コード例 #15
0
        public ActionResult TempFind(string iccode, bool isplate)
        {
            int      warehouse = 0;
            int      hallID    = 0;
            string   address   = "";
            Response resp      = new Response();

            resp = new CWTask().TempFindInfo(isplate, iccode, out warehouse, out hallID, out address);
            return(Json(new ReturnModel()
            {
                code = resp.Code, message = resp.Message, warehouse = warehouse, hallID = hallID, locaddrs = address, iccode = iccode
            }));
        }
コード例 #16
0
        /// <summary>
        /// 临时取物,需等待其他的车厅作业全部完成才允许添加
        /// </summary>
        /// <param name="iccode"></param>
        /// <param name="hall_ID"></param>
        /// <returns></returns>
        public int TempGetCar(string iccode, int hall_ID)
        {
            CICCard iccd = new CWICCard().SelectByUserCode(iccode);

            if (iccd == null)
            {
                return(109);
            }
            if (iccd.Status == CICCard.EnmICCardStatus.Disposed || iccd.Status == CICCard.EnmICCardStatus.Lost)
            {
                return(110);
            }
            CLocation lct = new CWLocation().SelectLctFromICCode(iccode);  //依存车卡号查询存车位

            if (lct == null)
            {
                return(101);
            }
            CSMG hall = new CWSMG().SelectSMG(hall_ID);

            if (hall.HallType != CSMG.EnmHallType.EnterorExit) //车厅类型
            {
                return(102);
            }
            if (!new CWSMG().CheckHallMode(hall.ID))    //判断车厅模式
            {
                return(103);
            }
            if (!new CWSMG().CheckAcceptNewCommand(hall.ID))  //车厅是否可接收新指令
            {
                return(104);
            }
            CMasterTask mtsk = new CWTask().GetMasterTaskFromICCode(iccode);

            if (mtsk != null)
            {
                return(105);    //该卡正在作业
            }
            int GetCarCount = new CWTask().GetMasterTaskNumOfHid(hall.ID, CMasterTask.EnmMasterTaskType.GetCar);

            if (GetCarCount > 0)
            {
                return(106);   //需待其他车厅的取车作业完成才允许添加
            }

            int rit = new CWTask().OTemp_GetCar(hall.ID, hall.Address, iccd, lct);

            return(rit);
        }
コード例 #17
0
        /// <summary>
        /// 手动完成
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public ActionResult ManualCompleteTask(int ids)
        {
            if (ids == 0)
            {
                return(Content("Fail"));
            }
            CWTask   cwtask = new CWTask();
            Response resp   = cwtask.ManualCompleteTask(ids);

            if (resp.Code == 1)
            {
                return(Content("操作成功!"));
            }

            return(Content("操作失败!"));
        }
コード例 #18
0
ファイル: CWDevice.cs プロジェクト: moruiyi/Parking2017
        /// <summary>
        /// 分配车厅
        /// </summary>
        /// <param name="lct"></param>
        /// <param name="isTemp">是否是临时取物</param>
        /// <returns></returns>
        public int AllocateHall(Location lct, bool isTemp)
        {
            List <Device> hallsList = FindList(d => d.Type == EnmSMGType.Hall);
            var           query     = from hall in hallsList
                                      where hall.Mode == EnmModel.Automatic &&
                                      hall.IsAble == 1 &&
                                      (isTemp ? hall.HallType == EnmHallType.EnterOrExit : hall.HallType != EnmHallType.Entrance)
                                      orderby Math.Abs(Convert.ToInt16(hall.Address.Substring(1, 2)) - lct.LocColumn) ascending
                                      select hall;

            List <Device> avaibleHalls = query.ToList();

            if (avaibleHalls.Count == 0)
            {
                return(0);
            }
            if (avaibleHalls.Count == 1)
            {
                return(avaibleHalls[0].DeviceCode);
            }
            Device first = avaibleHalls.Find(h => h.TaskID == 0);

            if (first != null)
            {
                return(first.DeviceCode);
            }
            Dictionary <int, int> _dicHallTaskCount = new Dictionary <int, int>();
            List <WorkTask>       queueList         = new CWTask().FindQueueList(q => true);

            foreach (Device dev in avaibleHalls)
            {
                int count = 0;
                foreach (WorkTask wt in queueList)
                {
                    if (dev.DeviceCode == wt.DeviceCode)
                    {
                        count++;
                    }
                }
                _dicHallTaskCount.Add(dev.DeviceCode, count);
            }
            Dictionary <int, int> dicHallOrder = _dicHallTaskCount.OrderBy(d => d.Value).ToDictionary(o => o.Key, p => p.Value);

            return(dicHallOrder.FirstOrDefault().Key);
        }
コード例 #19
0
        public async Task <ContentResult> UnpackUnloadOrder(int taskID)
        {
            try
            {
                CWTask        cwtask = new CWTask();
                ImplementTask itask  = await cwtask.FindITaskAsync(taskID);

                if (itask != null)
                {
                    int nback = await cwtask.UnpackUnloadOrderAsync(itask);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            return(Content("success"));
        }
コード例 #20
0
        public async Task <ContentResult> ODealEVUp(int taskID)
        {
            try
            {
                CWTask        cwtask = new CWTask();
                ImplementTask task   = await cwtask.FindITaskAsync(taskID);

                if (task != null)
                {
                    cwtask.ODealEVUp(task);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            return(Content("success"));
        }
コード例 #21
0
        public async Task <ContentResult> DealLoadFinishing(int taskID, int distance)
        {
            try
            {
                CWTask        cwtask = new CWTask();
                ImplementTask task   = await cwtask.FindITaskAsync(taskID);

                if (task != null)
                {
                    cwtask.DealLoadFinishing(task, distance);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            return(Content("success"));
        }
コード例 #22
0
        /// <summary>
        /// 获取指定作业的最大/小列
        /// </summary>
        private void isNeedMove(int tskID, out int pDestCol, bool le)
        {
            pDestCol = 0;
            CTask  tsk       = new CWTask().GetCTaskFromtskID(tskID);
            string frAddress = tsk.FromLctAdrs;
            string toAddress = tsk.ToLctAdrs;
            int    fromCol   = clcCommom.GetColOfAddress(frAddress);
            int    toCol     = clcCommom.GetColOfAddress(toAddress);

            if (le == true)
            {
                pDestCol = fromCol > toCol ? fromCol : toCol;
            }
            else
            {
                pDestCol = fromCol < toCol ? fromCol : toCol;
            }
        }
コード例 #23
0
        /// <summary>
        /// 查询临时卡收费
        /// </summary>
        /// <param name="iccode">卡号</param>
        /// <param name="tempLog">收费对象</param>
        /// <returns></returns>
        public int GetTempCardUserInfo(string iccode, out CTempCardChargeLog tempLog)
        {
            tempLog = null;
            CICCard iccd = this.SelectByUserCode(iccode);

            if (iccd == null)
            {
                return(101); //不是本系统用卡
            }
            if (iccd.Type != CICCard.EnmICCardType.Temp)
            {
                return(102); //该卡不是临时卡
            }

            CLocation lct = new CWLocation().SelectLctFromICCode(iccode);

            if (lct == null)
            {
                return(103); //该卡没有存车
            }
            CMasterTask mtsk = new CWTask().GetMasterTaskFromICCode(iccode);

            if (mtsk != null)
            {
                return(104); //该卡正在作业
            }

            tempLog                 = new CTempCardChargeLog();
            tempLog.ICCode          = iccode;
            tempLog.LocationAddress = lct.Address;
            tempLog.InDate          = lct.InDate;
            tempLog.OutDate         = DateTime.Now;

            tempLog.RecivFee = new CWNewTrariff().CalculateTempFee(tempLog.InDate, tempLog.OutDate);
            return(100);
        }
コード例 #24
0
 public CWTaskTran()
 {
     motsk = new CWTask();
 }
コード例 #25
0
        public ActionResult DeleteQueue(int ID)
        {
            Response rsp = new CWTask().ManualDeleteQueue(ID);

            return(Content(rsp.Message));
        }
コード例 #26
0
        /// <summary>
        /// 点击详情,查看信息
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public ActionResult QueueDetail(int ID)
        {
            WorkTask queue = new CWTask().FindQueue(mtsk => mtsk.ID == ID);

            return(View(queue));
        }
コード例 #27
0
        public JsonResult GetTaskList(int?pageSize, int?pageIndex, string sortOrder, string sortName)
        {
            Page <ImplementTask> page = new Page <ImplementTask>();

            if (pageSize != null)
            {
                page.PageSize = (int)pageSize;
            }
            if (pageIndex != null)
            {
                page.PageIndex = (int)pageIndex;
            }
            OrderParam orderParam = null;

            if (!string.IsNullOrEmpty(sortName))
            {
                orderParam = new OrderParam();
                orderParam.PropertyName = sortName;
                if (!string.IsNullOrEmpty(sortOrder))
                {
                    orderParam.Method = sortOrder.ToLower() == "asc" ? OrderMethod.Asc : OrderMethod.Desc;
                }
                else
                {
                    orderParam.Method = OrderMethod.Asc;
                }
            }
            Page <ImplementTask> pageTask = new CWTask().FindPageList(page, orderParam);

            List <DisplayITask> dispTaskLst = new List <DisplayITask>();

            foreach (ImplementTask itask in pageTask.ItemLists)
            {
                DisplayITask dtask = new DisplayITask
                {
                    ID               = itask.ID,
                    Warehouse        = itask.Warehouse,
                    DeviceCode       = itask.DeviceCode,
                    Type             = PlusCvt.ConvertTaskType(itask.Type),
                    Status           = PlusCvt.ConvertTaskStatus(itask.Status, itask.SendStatusDetail),
                    SendStatusDetail = PlusCvt.ConvertSendStateDetail(itask.SendStatusDetail),
                    CreateDate       = itask.CreateDate.ToString(),
                    SendDtime        = itask.SendDtime.ToString(),
                    HallCode         = itask.HallCode,
                    FromLctAddress   = itask.FromLctAddress,
                    ToLctAddress     = itask.ToLctAddress,
                    ICCardCode       = itask.ICCardCode,
                    Distance         = itask.Distance,
                    CarSize          = itask.CarSize,
                    CarWeight        = itask.CarWeight
                };
                dispTaskLst.Add(dtask);
            }
            int rcdNum = pageTask.TotalNumber;
            var data   = new
            {
                total = pageTask.TotalNumber,
                rows  = dispTaskLst
            };

            return(Json(data));
        }
コード例 #28
0
        /// <summary>
        /// MURO继续
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public ActionResult MUROTask(int ids)
        {
            Response resp = new CWTask().MUROTask(ids);

            return(Content(resp.Message));
        }
コード例 #29
0
        public ActionResult ResetTask(int tid)
        {
            Response res = new CWTask().ManualResetTask(tid);

            return(Content(res.Message));
        }
コード例 #30
0
        /// <summary>
        /// 分配车位:
        /// 1、优先分配中间区域的车位
        /// 2、判断ETV可达,车厅可达
        /// </summary>
        /// <param name="checkcode"></param>
        /// <returns></returns>
        public Location AllocateLoc(string checkcode)
        {
            //优先分配中间区域的车位
            int middlecolmn = 9;

            CWLocation cwlctn   = new CWLocation();
            CWDevice   cwdevice = new CWDevice();
            CWTask     cwtask   = new CWTask();
            CWICCard   cwiccd   = new CWICCard();

            #region 依距车厅的远近找出所有车位的集合
            List <Location> allLocLst  = cwlctn.FindLocList();
            List <Customer> fixCustLst = cwiccd.FindCustList(cu => cu.Type == EnmICCardType.FixedLocation || cu.Type == EnmICCardType.VIP);
            //排除固定车位
            List <Location> suitLocsLst = allLocLst.FindAll(lc => fixCustLst.Exists(cc => cc.LocAddress == lc.Address && cc.Warehouse == lc.Warehouse) == false);


            List <Location> sameLctnLst = new List <Location>();

            var locList_small = from loc in suitLocsLst
                                where loc.Type == EnmLocationType.Normal &&
                                loc.Status == EnmLocationStatus.Space &&
                                string.Compare(loc.LocSize, checkcode) == 0
                                orderby loc.LocSide ascending, Math.Abs(loc.LocColumn - middlecolmn) ascending
            select loc;

            var locList_big = from loc in suitLocsLst
                              where loc.Type == EnmLocationType.Normal &&
                              loc.Status == EnmLocationStatus.Space &&
                              string.Compare(loc.LocSize, checkcode) > 0
                              orderby loc.LocSide ascending, Math.Abs(loc.LocColumn - middlecolmn) ascending
            select loc;

            sameLctnLst.AddRange(locList_small);
            sameLctnLst.AddRange(locList_big);

            List <Location> lctnLst = new List <Location>();
            #region 如果是重列车位,优先分配前面车位是空闲的,其次是占用的,最后才是执行中的
            List <Location> spaceLctnLst  = new List <Location>();
            List <Location> occupyLctnLst = new List <Location>();
            List <Location> otherLctnLst  = new List <Location>();
            foreach (Location loc in sameLctnLst)
            {
                if (loc.LocSide == 4)
                {
                    #region 判断前面车位状态
                    string   fwdAddrs = "2" + loc.Address.Substring(1);
                    Location forward  = cwlctn.FindLocation(l => l.Address == fwdAddrs);
                    if (forward != null)
                    {
                        if (forward.Type == EnmLocationType.Normal)
                        {
                            if (forward.Status == EnmLocationStatus.Space)
                            {
                                spaceLctnLst.Add(loc);
                            }
                            else if (forward.Status == EnmLocationStatus.Occupy)
                            {
                                occupyLctnLst.Add(loc);
                            }
                            else
                            {
                                otherLctnLst.Add(loc);
                            }
                        }
                    }
                    #endregion
                }
                else if (loc.LocSide == 2)
                {
                    #region 判断后面车位状态
                    string   bckAddrs = "4" + loc.Address.Substring(1);
                    Location back     = cwlctn.FindLocation(l => l.Address == bckAddrs);
                    if (back != null)
                    {
                        if (back.Type == EnmLocationType.Normal)
                        {
                            if (back.Status == EnmLocationStatus.Space)
                            {
                                spaceLctnLst.Add(loc);
                            }
                            else if (back.Status == EnmLocationStatus.Occupy)
                            {
                                occupyLctnLst.Add(loc);
                            }
                            else
                            {
                                otherLctnLst.Add(loc);
                            }
                        }
                        else //禁用的
                        {
                            spaceLctnLst.Add(loc);
                        }
                    }

                    #endregion
                }
                else
                {
                    spaceLctnLst.Add(loc);
                }
            }
            lctnLst.AddRange(spaceLctnLst);
            lctnLst.AddRange(occupyLctnLst);
            lctnLst.AddRange(otherLctnLst);
            #endregion

            if (lctnLst.Count == 0)
            {
                return(null);
            }

            List <Device> nEtvList     = cwdevice.FindList(d => d.Type == EnmSMGType.ETV);
            WorkScope     workscope    = new WorkScope(nEtvList);
            List <Device> availHallLst = cwdevice.FindList(d => d.Type == EnmSMGType.Hall && d.Mode == EnmModel.Automatic);
            List <Device> availEtvLst  = nEtvList.FindAll(d => d.Mode == EnmModel.Automatic);

            if (availEtvLst.Count == 0 ||
                availHallLst.Count == 0)
            {
                return(null);
            }

            if (availEtvLst.Count == 2 && availHallLst.Count == 2)
            {
                return(lctnLst.FirstOrDefault());
            }
            if (availEtvLst.Count == 1)
            {
                CScope scope = workscope.GetEtvScope(availEtvLst[0]);
                if (availHallLst.Count == 2)
                {
                    foreach (Location loc in lctnLst)
                    {
                        if (loc.LocColumn >= scope.LeftCol && loc.LocColumn <= scope.RightCol)
                        {
                            return(loc);
                        }
                    }
                }
                else
                {
                    Device hall      = availHallLst[0];
                    int    hallcolmn = Convert.ToInt32(hall.Address.Substring(1, 2));
                    if (hallcolmn >= scope.LeftCol && hallcolmn <= scope.RightCol)
                    {
                        foreach (Location loc in lctnLst)
                        {
                            if (loc.LocColumn >= scope.LeftCol && loc.LocColumn <= scope.RightCol)
                            {
                                return(loc);
                            }
                        }
                    }
                }
            }

            #endregion

            return(null);
        }