Example #1
0
        /// <summary>
        /// 固定用户信息改变时推送
        /// </summary>
        private void ParkingSingleton_FixLocsWatchEvent(Location loc, int isfix, string custname, string deadline, string rcdplate)
        {
            LocsMapping map = new LocsMapping
            {
                Warehouse = loc.Warehouse,
                Address   = loc.Address,
                LocSide   = loc.LocSide,
                LocColumn = loc.LocColumn,
                LocLayer  = loc.LocLayer,
                Type      = loc.Type,
                Status    = loc.Status,
                LocSize   = loc.LocSize,
                ICCode    = loc.ICCode,
                WheelBase = loc.WheelBase,
                CarWeight = loc.CarWeight,
                CarSize   = loc.CarSize,
                InDate    = loc.InDate.ToString(),
                PlateNum  = loc.PlateNum,
                IsFixLoc  = isfix,
                CustName  = custname,
                Deadline  = deadline,
                RcdPlate  = rcdplate
            };

            Clients.All.feedbackLocInfo(map);
        }
Example #2
0
        /// <summary>
        /// 查询车位
        /// </summary>
        /// <param name="locinfo">库区_边_列_层</param>
        /// <returns></returns>
        public async Task <JsonResult> GetLocation(string locinfo)
        {
            string[] info = locinfo.Split('_');
            if (info.Length < 4)
            {
                var nback = new
                {
                    code = 0,
                    data = "数据长度不正确," + locinfo
                };
                return(Json(nback, JsonRequestBehavior.AllowGet));
            }
            Location lctn = null;

            int    wh      = Convert.ToInt32(info[0]);
            string address = info[1] + info[2].PadLeft(2, '0') + info[3].PadLeft(2, '0');

            lctn = await new CWLocation().FindLocationAsync(lc => lc.Address == address && lc.Warehouse == wh);
            if (lctn == null)
            {
                var nback = new
                {
                    code = 0,
                    data = "找不到车位," + locinfo
                };
                return(Json(nback, JsonRequestBehavior.AllowGet));
            }

            Customer cust     = new CWICCard().FindFixLocationByAddress(lctn.Warehouse, lctn.Address);
            int      isfix    = 0;
            string   custname = "";
            string   deadline = "";
            string   rcdplate = "";

            if (cust != null)
            {
                isfix    = 1;
                custname = cust.UserName;
                deadline = cust.Deadline.ToString();
                rcdplate = cust.PlateNum;
            }
            LocsMapping map = new LocsMapping
            {
                Warehouse = lctn.Warehouse,
                Address   = lctn.Address,
                LocSide   = lctn.LocSide,
                LocColumn = lctn.LocColumn,
                LocLayer  = lctn.LocLayer,
                Type      = lctn.Type,
                Status    = lctn.Status,
                LocSize   = lctn.LocSize,
                ICCode    = lctn.ICCode,
                WheelBase = lctn.WheelBase,
                CarWeight = lctn.CarWeight,
                CarSize   = lctn.CarSize,
                InDate    = lctn.InDate.ToString(),
                PlateNum  = lctn.PlateNum,
                IsFixLoc  = isfix,
                CustName  = custname,
                Deadline  = deadline,
                RcdPlate  = rcdplate
            };
            var ret = new
            {
                code = 1,
                data = map
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        /// <summary>
        /// 初始化界面用
        /// </summary>
        /// <returns></returns>
        public async Task <JsonResult> GetLocationList()
        {
            Log log = LogFactory.GetLogger("GetLocationList");

            try
            {
                CWICCard cwiccd = new CWICCard();

                List <Location> locList      = await new CWLocation().FindLocationListAsync();
                List <Customer> bindCustsLst = await cwiccd.FindCustListAsync(cc => cc.Type == EnmICCardType.FixedLocation || cc.Type == EnmICCardType.VIP);

                List <LocsMapping> mappingsLst = new List <LocsMapping>();
                foreach (Location loc in locList)
                {
                    Customer cust     = bindCustsLst.Find(cc => cc.LocAddress == loc.Address && cc.Warehouse == loc.Warehouse);
                    int      isfix    = 0;
                    string   custname = "";
                    string   deadline = "";
                    string   rcdplate = "";

                    if (cust != null)
                    {
                        isfix    = 1;
                        custname = cust.UserName;
                        deadline = cust.Deadline.ToString();
                        rcdplate = cust.PlateNum;
                    }
                    LocsMapping map = new LocsMapping
                    {
                        Warehouse = loc.Warehouse,
                        Address   = loc.Address,
                        LocSide   = loc.LocSide,
                        LocColumn = loc.LocColumn,
                        LocLayer  = loc.LocLayer,
                        Type      = loc.Type,
                        Status    = loc.Status,
                        LocSize   = loc.LocSize,
                        ICCode    = loc.ICCode,
                        WheelBase = loc.WheelBase,
                        CarWeight = loc.CarWeight,
                        CarSize   = loc.CarSize,
                        InDate    = loc.InDate.ToString(),
                        PlateNum  = loc.PlateNum,
                        IsFixLoc  = isfix,
                        CustName  = custname,
                        Deadline  = deadline,
                        RcdPlate  = rcdplate
                    };
                    mappingsLst.Add(map);
                }
                var nback = new
                {
                    code = 1,
                    data = mappingsLst
                };
                return(Json(nback, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            var bback = new
            {
                code = 0,
                data = "系统异常"
            };

            return(Json(bback, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        /// <summary>
        /// 推送车位信息
        /// </summary>
        /// <param name="loc"></param>
        private void FileWatch_LctnWatchEvent(int type, Location loca)
        {
            try
            {
                #region 更新车位状态
                if (loca != null)
                {
                    Customer cust     = new CWICCard().FindFixLocationByAddress(loca.Warehouse, loca.Address);
                    int      isfix    = 0;
                    string   custname = "";
                    string   deadline = "";
                    string   platenum = "";
                    if (cust != null)
                    {
                        isfix    = 1;
                        custname = cust.UserName;
                        deadline = cust.Deadline.ToString();
                        platenum = cust.PlateNum;
                    }

                    LocsMapping map = new LocsMapping
                    {
                        Warehouse = loca.Warehouse,
                        Address   = loca.Address,
                        LocSide   = loca.LocSide,
                        LocColumn = loca.LocColumn,
                        LocLayer  = loca.LocLayer,
                        Type      = loca.Type,
                        Status    = loca.Status,
                        LocSize   = loca.LocSize,
                        ICCode    = loca.ICCode,
                        WheelBase = loca.WheelBase,
                        CarWeight = loca.CarWeight,
                        CarSize   = loca.CarSize,
                        InDate    = loca.InDate.ToString(),
                        PlateNum  = loca.PlateNum,
                        IsFixLoc  = isfix,
                        CustName  = custname,
                        Deadline  = deadline,
                        RcdPlate  = platenum
                    };

                    Clients.All.feedbackLocInfo(map);
                }
                #endregion
                #region 更新统计信息
                Task.Factory.StartNew(() =>
                {
                    var info = new CWLocation().GetLocStatisInfo();
                    Clients.All.feedbackStatistInfo(info);

                    var data = new
                    {
                        small = info.SmallSpace,
                        big   = info.BigSpace
                    };
                    string json = JsonConvert.SerializeObject(data);
                    Clients.All.LocStateToLed(json);
                });
                #endregion
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
        }