Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="operation"></param>
        /// <param name="opertionnum">真实源车车号</param>
        /// <param name="num">方量</param>
        public void AddHistory(TZRalation entity, string operation, string opertionnum, decimal?operationcube, string state)
        {
            //插入历史数据
            TZRalationHistory history = new TZRalationHistory();

            history.ActionCube  = entity.ActionCube;
            history.ActionTime  = entity.ActionTime;
            history.ActionType  = entity.ActionType;
            history.AH          = entity.AH;
            history.Auditor     = entity.Auditor;
            history.AuditTime   = entity.AuditTime;
            history.Builder     = entity.Builder;
            history.BuildTime   = entity.BuildTime;
            history.CarID       = entity.CarID;
            history.CarWeight   = entity.CarWeight;
            history.Cube        = entity.Cube;
            history.DealMan     = entity.DealMan;
            history.DealTime    = entity.DealTime;
            history.Driver      = entity.Driver;
            history.DriverUser  = entity.DriverUser;
            history.Exchange    = entity.Exchange;
            history.ID          = entity.ID;
            history.IsAudit     = entity.IsAudit;
            history.IsCompleted = entity.IsCompleted;

            //if (operation == "delete")
            //    history.IsLock = "-1";
            //else
            //    history.IsLock = entity.IsLock;
            history.IsLock = state;

            history.Lifecycle         = entity.Lifecycle;
            history.Modifier          = entity.Modifier;
            history.ModifyTime        = entity.ModifyTime;
            history.ReturnReason      = entity.ReturnReason;
            history.ReturnType        = entity.ReturnType;
            history.ShippingDocument  = entity.ShippingDocument;
            history.ShippingDocuments = entity.ShippingDocuments;
            //history.SourceCarID = entity.SourceCarID;
            //history.SourceConStrength = entity.SourceConStrength;
            history.SourceCube = entity.SourceCube;
            //history.SourceProjectName = entity.SourceProjectName;
            history.SourceShipDocID        = entity.SourceShipDocID;
            history.SourceShippingDocument = entity.SourceShippingDocument;
            //history.TargetConStrength = entity.TargetConStrength;
            //history.TargetProjectName = entity.TargetProjectName;
            history.TargetShipDocID        = entity.TargetShipDocID;
            history.TargetShippingDocument = entity.TargetShippingDocument;
            history.TotalWeight            = entity.TotalWeight;
            history.Version       = entity.Version;
            history.Weight        = entity.Weight;
            history.ParentID      = entity.ID;
            history.operation     = operation;
            history.operationnum  = opertionnum;
            history.operationcube = operationcube;

            base.Add(history);
        }
Example #2
0
        public ActionResult Save(SchedulerViewModel entity)
        {
            lock (obj)
            {
                try
                {
                    if (bool.Parse(this.service.SysConfig.GetSysConfig("Gps").ConfigValue)) //若GPS开关打开,只能发送待命队列中的车
                    {
                        Car c = this.service.Car.Get(entity.ShippingDocument.CarID);
                        if (c.CarStatus != Model.Enums.CarStatus.AllowShipCar)
                        {
                            return(OperateResult(false, "在使用GPS的情况下,只能调派待命状态的车辆。", null));
                        }
                    }

                    //判断是否存在自动过磅并且未处理的记录
                    TZRalation objchk = this.service.TZRalation.Query()
                                        .Where(p => p.CarID == entity.ShippingDocument.CarID && p.IsCompleted == false).OrderByDescending(p => p.BuildTime)
                                        .FirstOrDefault();
                    if (objchk != null)
                    {
                        if (string.IsNullOrEmpty(objchk.ActionType))
                        {
                            IList <SysFunc> FuncList = this.service.User.GetUserFuncs(AuthorizationService.CurrentUserID);
                            SysFunc         sf       = FuncList.Where(p => p.ID == "410505").FirstOrDefault();
                            if (sf != null)              //有权限
                            {
                                return(OperateResult(false, Lang.Msg_hasAutoTz, objchk));
                            }
                            else
                            {
                                return(OperateResult(false, Lang.Msg_hasAutoTz, 0));
                            }
                        }
                    }

                    string      taskid      = entity.ShippingDocument.TaskID;
                    ProduceTask produceTask = this.service.ProduceTask.Get(taskid);
                    SysConfig   config      = this.service.SysConfig.GetSysConfig(Model.Enums.SysConfigEnum.IsAllowConsMixpropLimit);
                    if (config != null && config.ConfigValue == "true" && produceTask.CementType == Model.Enums.CementType.CommonCement)
                    {
                        string measureError = this.service.DispatchList.CheckCheckMesureScale(entity);
                        if (!string.IsNullOrEmpty(measureError))
                        {
                            return(OperateResult(false, measureError, null));
                        }
                    }
                    //检查合同限额控制
                    string msg = this.service.DispatchList.CheckCubeLimit(entity);
                    if (!string.IsNullOrEmpty(msg))
                    {
                        return(OperateResult(true, msg, null));
                    }

                    entity.DispatchList.Field2 = "";
                    if (entity.DispatchList.SlurryCount > 0 && entity.DispatchList.BetonCount == 0)
                    {
                        entity.DispatchList.Field2 = "1";
                    }

                    SchedulerViewModel saveEntity = this.service.DispatchList.SaveScheduler(entity);
                    return(OperateResult(true, Lang.Msg_Operate_Success, saveEntity.ShippingDocument.GetId()));
                }
                catch (Exception e)
                {
                    return(OperateResult(false, Lang.Msg_Operate_Failed + e.Message, null));
                }
            }
        }