Exemplo n.º 1
0
        /// <summary>
        /// 获取搅拌车不同状态的车辆信息
        /// </summary>
        /// <returns></returns>
        public dynamic GetMixerCarStatus()
        {
            IList <Car> carList = this.Query()
                                  .Where(c => c.CarTypeID == CarType.Mixer)
                                  .Where(c => c.IsUsed == true)
                                  .OrderBy(c => c.OrderNum).OrderBy(c => c.ID).ToList();
            SysConfig config = new SysConfigService(this.m_UnitOfWork).GetSysConfig(SysConfigEnum.IsCarLendFilter);

            if (config != null && config.ConfigValue == "true")
            {
                var carLendItemList = new CarLendItemService(this.m_UnitOfWork).All("BackTime is null", "ID", true);
                Car car             = null;
                foreach (CarLendItem item in carLendItemList)
                {
                    car = carList.FirstOrDefault(c => c.ID == item.CarID);
                    if (car != null)
                    {
                        carList.Remove(car);
                    }
                }
            }
            //查询几种状态的车辆
            dynamic carInfo = new
            {
                Result       = true,
                Message      = string.Empty,
                AllowShipCar = carList.Where(c => c.CarStatus == CarStatus.AllowShipCar),
                ShippingCar  = carList.Where(c => c.CarStatus == CarStatus.ShippingCar),
                RestCar      = carList.Where(c => c.CarStatus == CarStatus.RestCar)
            };

            return(carInfo);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 取得泵车下拉列表数据
        /// </summary>
        /// <returns></returns>
        public IList <Car> GetPumpList()
        {
            var       carList = this.GetCarSelectList(ZLERP.Model.Enums.CarType.Pump);
            SysConfig config  = new SysConfigService(this.m_UnitOfWork).GetSysConfig(SysConfigEnum.IsCarLendFilter);

            if (config != null && config.ConfigValue == "true")
            {
                var carLendItemList = new CarLendItemService(this.m_UnitOfWork).All("BackTime is null", "ID", true);
                Car car             = null;
                foreach (CarLendItem item in carLendItemList)
                {
                    car = carList.FirstOrDefault(c => c.ID == item.CarID);
                    if (car != null)
                    {
                        carList.Remove(car);
                    }
                }
            }
            return(carList);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 取得搅拌车列表,按车号排序
        /// </summary>
        /// <returns></returns>
        public IList <Car> GetMixerCarListOrderByID()
        {
            var       carList = GetMixerCarList();
            SysConfig config  = new SysConfigService(this.m_UnitOfWork).GetSysConfig(SysConfigEnum.IsCarLendFilter);

            if (config != null && config.ConfigValue == "true")
            {
                var carLendItemList = new CarLendItemService(this.m_UnitOfWork).All("BackTime is null", "ID", true);
                Car car             = null;
                foreach (CarLendItem item in carLendItemList)
                {
                    car = carList.FirstOrDefault(c => c.ID == item.CarID);
                    if (car != null)
                    {
                        carList.Remove(car);
                    }
                }
            }
            if (carList != null)
            {
                carList = carList.OrderBy(p => p.ID.PadLeft(3, '0')).ToList();
            }
            return(carList);
        }
Exemplo n.º 4
0
        public dynamic GetLastDocByTaskId(string taskid)
        {
            ShippingDocument doc = this.Find("TaskID = '" + taskid + "' AND IsEffective = 1 AND ShipDocType = '0'", 1, 1, "ID", "DESC").FirstOrDefault();

            //已下配比生产线判断不全面,如1#线下了混凝土配比,2#线只下了砂浆配比,搅拌机组下拉框中只有有1#线
            //只有砂浆配比的情况,只要判断IsSlurry = 0的数量是否为0
            //IList<ConsMixprop> phblistcount = this.m_UnitOfWork.ConsMixpropRepository.Find("TaskID = '" + taskid + "' AND IsSlurry = 0", 1, 30, "ProductLineID", "ASC");
            //IList<ConsMixprop> phblist = null;
            //if (phblistcount.Count == 0)
            //{
            //    phblist = this.m_UnitOfWork.ConsMixpropRepository.Find("TaskID = '" + taskid + "' AND AuditStatus = 1 ", 1, 30, "ProductLineID", "ASC");
            //}
            //else {
            //    phblist = this.m_UnitOfWork.ConsMixpropRepository.Find("TaskID = '" + taskid + "' AND AuditStatus = 1 AND IsSlurry = 0", 1, 30, "ProductLineID", "ASC");
            //}

            IList <ConsMixprop> phblist = null;

            phblist = this.m_UnitOfWork.ConsMixpropRepository.Find("TaskID = '" + taskid + "' AND AuditStatus = 1 ", 1, 30, "ProductLineID", "ASC");

            IList <string>      pdlist        = phblist.Select(p => p.ProductLineID).Distinct().ToList();
            IList <ProductLine> productlines  = null;
            SysConfigService    configService = new SysConfigService(this.m_UnitOfWork);

            if (pdlist.Count > 0)
            {
                productlines = this.m_UnitOfWork.GetRepositoryBase <ProductLine>()
                               .Query().Where(p => p.IsUsed && pdlist.Contains(p.ID))
                               .OrderBy(p => p.ID).ToList();
                //获取所有未完成的单
                IList <DispatchList> dispatchList = this.m_UnitOfWork.GetRepositoryBase <DispatchList>()
                                                    .Query().Where(d => d.IsCompleted == false).OrderBy(d => d.DispatchOrder).ToList();

                //计算预计发车时间
                //SysConfig delayConfig = this.m_UnitOfWork.GetRepositoryBase<SysConfig>()
                //    .Find("ConfigName = 'DelayDeliveryTime'", 1, 1, "ID", "DESC").FirstOrDefault();
                SysConfig delayConfig = configService.GetSysConfig(SysConfigEnum.DelayDeliveryTime);

                int delayTime = delayConfig == null ? 8 : Convert.ToInt32(delayConfig.ConfigValue);//未找到参数,默认8
                foreach (ProductLine item in productlines)
                {
                    string id    = item.ID;
                    int    count = dispatchList.Where(d => d.ProductLineID == id).ToList().Count + 1;
                    //将预计发车时间赋值给productline的modifytime
                    int      delayMinute  = count * delayTime;
                    DateTime deliveryTime = DateTime.Now.AddMinutes(delayMinute);
                    item.ModifyTime = deliveryTime;
                }
            }
            //自动选中车辆
            SysConfig config        = configService.GetSysConfig(Model.Enums.SysConfigEnum.AutoSelectCarID);
            bool      autoSelectCar = config == null ? true : Convert.ToBoolean(config.ConfigValue);
            string    autoCarID     = string.Empty;

            if (autoSelectCar)
            {
                Car         crtCar  = null;
                IList <Car> carList = this.m_UnitOfWork.GetRepositoryBase <Car>().Query()
                                      .Where(p => p.CarStatus == CarStatus.AllowShipCar && p.CarTypeID == CarType.Mixer && p.IsUsed)
                                      .OrderBy(p => p.OrderNum).OrderBy(p => p.ID).ToList();
                SysConfig carLendFilterConfig = configService.GetSysConfig(Model.Enums.SysConfigEnum.IsCarLendFilter);
                if (carLendFilterConfig != null && carLendFilterConfig.ConfigValue == "true")
                {
                    var carLendList = new CarLendItemService(this.m_UnitOfWork).All("BackTime is null", "ID", true).Select(c => c.CarID);
                    crtCar = carList.Where(p => !carLendList.Contains(p.ID)).FirstOrDefault();
                }
                else
                {
                    crtCar = carList.FirstOrDefault();
                }
                if (crtCar != null)
                {
                    autoCarID = crtCar.ID;
                }
            }

            CustomerPlan cp = new CustomerPlan();


            cp = new PublicService().CustomerPlan.Query().Where(m => m.TaskID == taskid).FirstOrDefault();


            return(new {
                Result = true
                , Message = string.Empty
                , Remark = doc == null ? string.Empty : (doc.Remark != null && doc.Remark.IndexOf("CODEADD") >= 0 ? doc.Remark.Remove(doc.Remark.IndexOf("CODEADD")) : doc.Remark)

                           //,PumpName = doc == null ? string.Empty : doc.PumpName
                , PumpName = doc == null ? (cp == null?string.Empty:cp.PumpName) : doc.PumpName
                ,
                PumpMan = doc == null? (cp == null ? string.Empty : cp.PumpMan):doc.PumpMan

                , ProvidedCube = doc == null ? 0 : doc.ProvidedCube
                , PlanCube = doc == null ? 0 : doc.PlanCube
                             //累计车数
                , ProvidedTimes = doc == null ? 0 : doc.ProvidedTimes
                             //生产线
                , ProductLines = productlines
                             //自动选中的车辆
                , AutoCarID = autoCarID
            });
        }