Ejemplo n.º 1
0
 public ActionResult Refuse(string keyvalue, int type)
 {
     if (type == 0)
     {//拜访车辆(有车)
         VisitcarEntity car = visitcarbll.GetEntity(keyvalue);
         car.State = 99;
         visitcarbll.SaveForm(keyvalue, car);
     }
     else if (type == 3)
     {//拜访人员
         CarUserEntity car = CarUserbll.GetEntity(keyvalue);
         car.State = 99;
         CarUserbll.SaveForm(keyvalue, car, null);
     }
     else if (type == 1)
     {//物料车
         OperticketmanagerBLL    obll = new OperticketmanagerBLL();
         OperticketmanagerEntity op   = obll.GetEntity(keyvalue);
         op.ExamineStatus = 99;
         obll.SaveForm(keyvalue, op);
     }
     else
     {//2危化品车
         HazardouscarBLL    hbll = new HazardouscarBLL();
         HazardouscarEntity ha   = hbll.GetEntity(keyvalue);
         ha.State = 99;
         hbll.Update(keyvalue, ha);
     }
     return(Success("操作成功。"));
 }
Ejemplo n.º 2
0
        public ActionResult ChangeState(string keyvalue, int type, int state)
        {
            //根据危化品类型添加二级节点
            #region 获取编码管理配置信息
            var    data = dataItemDetailBLL.GetDataItemListByItemCode("'SocketUrl'");
            string IP   = "";
            int    Port = 0;
            foreach (var item in data)
            {
                if (item.ItemName == "IP")
                {
                    IP = item.ItemValue;
                }
                else if (item.ItemName == "Port")
                {
                    Port = Convert.ToInt32(item.ItemValue);
                }
            }

            DataItemDetailBLL pdata = new DataItemDetailBLL();
            string            key   = string.Empty;         // "21049470";
            string            sign  = string.Empty;         // "4gZkNoh3W92X6C66Rb6X";
            var pitem   = pdata.GetItemValue("Hikappkey");  //海康服务器密钥
            var baseurl = pdata.GetItemValue("HikBaseUrl"); //海康服务器地址
            if (!string.IsNullOrEmpty(pitem))
            {
                key  = pitem.Split('|')[0];
                sign = pitem.Split('|')[1];
            }
            #endregion
            state++;
            if (type == 0)
            {//拜访车辆
                VisitcarEntity car = visitcarbll.GetEntity(keyvalue);
                car.State  = state;
                car.InTime = DateTime.Now;
                visitcarbll.SaveForm(keyvalue, car);
                CarAlgorithmEntity Car = new CarAlgorithmEntity();
                Car.CarNo     = car.CarNo;
                Car.GPSID     = car.GPSID;
                Car.GPSName   = car.GPSNAME;
                Car.ID        = car.ID;
                Car.Type      = 3;
                Car.State     = 0;
                Car.LineName  = car.LineName;
                Car.GoodsName = "";
                SocketHelper.SendMsg(Car.ToJson(), IP, Port);
                //车辆放行 (疫情期间此功能暂时屏蔽)
                //AddCarpermission(baseurl, key, sign, car.CarNo, car.Phone, car.Dirver);
                var baselist = CarUserbll.addUserJurisdiction(keyvalue, state, baseurl, key, sign);
                return(Content(baselist.ToJson()));
            }
            else if (type == 3)
            {//拜访人员
                CarUserEntity car = CarUserbll.GetEntity(keyvalue);
                car.State  = type;
                car.InTime = DateTime.Now;
                CarUserbll.SaveForm(keyvalue, car, null);
                //人员添加出入权限
                var baselist = CarUserbll.addUserJurisdiction(keyvalue, state, baseurl, key, sign);
                return(Content(baselist.ToJson()));
            }
            else if (type == 1)
            {//物料车辆
                string parkNames             = "1号岗,二号地磅";
                OperticketmanagerBLL    obll = new OperticketmanagerBLL();
                OperticketmanagerEntity op   = obll.GetEntity(keyvalue);
                op.ExamineStatus = state;
                if (state == 3)
                {
                    op.Getdata = DateTime.Now;
                }
                obll.SaveForm(keyvalue, op);
                CarAlgorithmEntity Car = new CarAlgorithmEntity();
                Car.CarNo   = op.Platenumber;
                Car.GPSID   = op.GpsId;
                Car.GPSName = op.GpsName;
                Car.ID      = op.ID;
                Car.State   = 0;
                Car.Type    = 4;
                string Dress = op.Dress;
                Car.GoodsName = Dress;
                int    ISwharf       = op.ISwharf;
                string Transporttype = op.Transporttype;
                if (Transporttype == "提货")
                {
                    Car.LineName = op.Dress + Transporttype;
                    if (ISwharf == 1)
                    {
                        Car.LineName += "(码头)";
                        parkNames    += ",码头岗";
                    }
                }
                else
                {
                    if (ISwharf == 1)
                    {
                        Car.LineName = "物料转运(码头)";
                        parkNames   += ",码头岗";
                    }
                    else
                    {
                        Car.LineName = "转运(纯称重)";
                    }
                }
                SocketHelper.SendMsg(Car.ToJson(), IP, Port);
                //车辆放行
                AddCarpermission(baseurl, key, sign, op.Platenumber, op.DriverName, op.DriverTel, parkNames);
                return(Success("操作成功。"));
            }
            else
            {//危化品车辆
                HazardouscarBLL    hbll = new HazardouscarBLL();
                HazardouscarEntity ha   = hbll.GetEntity(keyvalue);
                ha.State  = state;
                ha.InTime = DateTime.Now;
                hbll.Update(keyvalue, ha);
                CarAlgorithmEntity Car = new CarAlgorithmEntity();
                Car.CarNo     = ha.CarNo;
                Car.GPSID     = ha.GPSID;
                Car.GPSName   = ha.GPSNAME;
                Car.ID        = ha.ID;
                Car.Type      = 5;
                Car.State     = 0;
                Car.LineName  = ha.HazardousName;
                Car.GoodsName = ha.HazardousName;
                SocketHelper.SendMsg(Car.ToJson(), IP, Port);
                //车辆放行
                CarIn(baseurl, key, sign, ha.CarNo, ha.Phone, ha.Dirver);
                //人员添加出入权限
                var baselist = CarUserbll.addUserJurisdiction(keyvalue, state, baseurl, key, sign);
                return(Content(baselist.ToJson()));
            }
        }