Beispiel #1
0
        public async Task <DeployEntity> AddOrderDeploymentDown(DeployEntity model)
        {
            model.Should().NotBeNull();
            model.OrderUID.Should().NotBeNullOrEmpty();
            model.ImageJson.Should().NotBeNullOrEmpty();
            model.DeployerUID.Should().NotBeNullOrEmpty();

            model.DeploymentType = (int)DeployTypeEnum.Down;

            model.InitSelf();

            var db = this._repo.Database;

            var order = await db.Set <OrderEntity>().FirstOrDefaultAsync(x => x.UID == model.OrderUID);

            order.Should().NotBeNull();

            if (order.Status != (int)OrderStatusEnum.)
            {
                throw new MsgException("当前状态不能下刊");
            }

            order.Status        = (int)OrderStatusEnum.交易完成;
            order.FinishTimeUtc = DateTime.UtcNow;

            db.Set <DeployEntity>().Add(model);
            await db.SaveChangesAsync();

            return(model);
        }
Beispiel #2
0
        public async Task <DeployEntity> AddOrderDeploymentUp(DeployEntity model)
        {
            model.Should().NotBeNull();
            model.OrderUID.Should().NotBeNullOrEmpty();
            model.ImageJson.Should().NotBeNullOrEmpty();
            model.DeployerUID.Should().NotBeNullOrEmpty();

            model.DeploymentType = (int)DeployTypeEnum.Up;

            model.InitSelf();

            var db = this._repo.Database;

            var order = await db.Set <OrderEntity>().FirstOrDefaultAsync(x => x.UID == model.OrderUID);

            order.Should().NotBeNull();

            if (order.Status != (int)OrderStatusEnum.设计确认)
            {
                throw new MsgException("当前状态不能上刊");
            }

            order.Status          = (int)OrderStatusEnum.;
            order.DeployUpTimeUtc = DateTime.UtcNow;
            if (ValidateHelper.IsEmpty(order.TFNo))
            {
                order.TFNo = $"TF{order.Id.ToString().PadLeft(this.OrderNoLength, '0')}";
            }

            db.Set <DeployEntity>().Add(model);
            await db.SaveChangesAsync();

            return(model);
        }