/// <summary>
        /// 添加出库信息
        /// </summary>
        /// <param name="dtos">要添加的出库信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        public virtual async Task <OperationResult> CreateOutStors(params OutStorInputDto[] dtos)
        {
            Check.Validate <OutStorInputDto, int>(dtos, nameof(dtos));

            //通过ID获取Name

            foreach (OutStorInputDto dto in dtos)
            {
                MatBasedata matdb = await MatBasedataRepository.GetAsync(dto.MatId);

                CusBasedata cusdb = await CusBasedataRepository.GetAsync(dto.CusId);

                EmpBasedata empdb = await EmpBasedataRepository.GetAsync(dto.OutEmpId);

                dto.MatName    = matdb.MatName;
                dto.CusName    = cusdb.CusName;
                dto.OutEmpName = empdb.EmpName;


                //修改人员工作状态
                empdb.EmpWorkState = true;
                EmpBasedataRepository.Update(empdb);
            }
            return(await OutStorRepository.InsertAsync(dtos));
        }
Beispiel #2
0
 /// <summary>
 /// 初始化一个<see cref="MatBasedataOutputDto"/>类型的新实例
 /// </summary>
 public MatBasedataOutputDto(MatBasedata entity)
 {
     Id           = entity.Id;
     MatId        = entity.MatId;
     MatName      = entity.MatName;
     MatParameter = entity.MatParameter;
     MatUnit      = entity.MatUnit;
     SafeStock    = entity.SafeStock;
     CurrStock    = entity.CurrStock;
     MaxStock     = entity.MaxStock;
     MatRemark    = entity.MatRemark;
     MatState     = entity.MatState;
     CreatedTime  = entity.CreatedTime;
 }
Beispiel #3
0
        /// <summary>
        /// 更新入库审核信息
        /// </summary>
        /// <param name="dtos">包含更新信息的入库信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        public virtual async Task <OperationResult> UpdateVerifyInStors(InStorInputDto[] dtos)
        {
            Check.Validate <InStorInputDto, int>(dtos, nameof(dtos));
            //如果通过则修改库存信息,驳回则不修改

            if (dtos[0].InstorVerifyState == "已通过")
            {
                MatBasedata matdb = await MatBasedataRepository.GetAsync(dtos[0].MatId);


                //Expression<Func<MatBasedata, bool>> predicate = m => m.MatName.Contains(dtos[0].MatId);

                matdb.CurrStock = matdb.CurrStock + dtos[0].InstorNum;
                MatBasedataRepository.Update(matdb);
            }
            return(await InStorRepository.UpdateAsync(dtos).ConfigureAwait(false));
        }
Beispiel #4
0
        /// <summary>
        /// 添加入库信息
        /// </summary>
        /// <param name="dtos">要添加的入库信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        public virtual async Task <OperationResult> CreateInStors(params InStorInputDto[] dtos)
        {
            Check.Validate <InStorInputDto, int>(dtos, nameof(dtos));
            //通过ID新增Name

            foreach (InStorInputDto dto in dtos)
            {
                MatBasedata matdb = await MatBasedataRepository.GetAsync(dto.MatId);

                SupBasedata supdb = await SupBasedataRepository.GetAsync(dto.SupId);

                dto.MatName = matdb.MatName;
                dto.SupName = supdb.SupName;
            }

            return(await InStorRepository.InsertAsync(dtos));
        }
Beispiel #5
0
 /// <summary>
 /// 初始化一个<see cref="MatBasedataOutputDto"/>类型的新实例
 /// </summary>
 public MatBasedataOutputDto(MatBasedata entity)
 {
     Id          = entity.Id;
     MatId       = entity.MatId;
     MatName     = entity.MatName;
     MatAlias01  = entity.MatAlias01;
     MatAlias02  = entity.MatAlias02;
     MatAlias03  = entity.MatAlias03;
     MatAlias04  = entity.MatAlias04;
     MatAlias05  = entity.MatAlias05;
     MatUnit     = entity.MatUnit;
     SafeStock   = entity.SafeStock;
     CurrStock   = entity.CurrStock;
     MaxStock    = entity.MaxStock;
     MatRemark   = entity.MatRemark;
     MatState    = entity.MatState;
     CreatedTime = entity.CreatedTime;
 }
        /// <summary>
        /// 更新反冲信息
        /// </summary>
        /// <param name="dtos">包含更新信息的反冲信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        public virtual async Task <OperationResult> UpdateRecoilOutStors(params OutStorInputDto[] dtos)
        {
            Check.Validate <OutStorInputDto, int>(dtos, nameof(dtos));

            //强制修改反冲状态
            if (dtos[0].RecoilNum != 0)
            {
                dtos[0].RecoilState = true;
            }
            //修改库存
            MatBasedata matdb = await MatBasedataRepository.GetAsync(dtos[0].MatId);

            matdb.CurrStock = matdb.CurrStock + dtos[0].RecoilNum;
            MatBasedataRepository.Update(matdb);

            //累计反冲数量
            OutStor Instordb = await OutStorRepository.GetAsync(dtos[0].Id);

            dtos[0].RecoilNum = dtos[0].RecoilNum + Instordb.RecoilNum;

            return(await OutStorRepository.UpdateAsync(dtos));
        }
Beispiel #7
0
        /// <summary>
        /// 更新入库反冲信息
        /// </summary>
        /// <param name="dtos">包含更新信息的入库信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        public virtual async Task <OperationResult> UpdateRecoilInStors(InStorInputDto[] dtos)
        {
            Check.Validate <InStorInputDto, int>(dtos, nameof(dtos));
            //强制修改反冲状态
            if (dtos[0].RecoilNum != 0)
            {
                dtos[0].RecoilState = true;
            }
            //修改库存信息
            MatBasedata matdb = await MatBasedataRepository.GetAsync(dtos[0].MatId);

            matdb.CurrStock = matdb.CurrStock - dtos[0].RecoilNum;
            MatBasedataRepository.Update(matdb);
            //累计反冲数量
            InStor Instordb = await InStorRepository.GetAsync(dtos[0].Id);

            dtos[0].RecoilNum = dtos[0].RecoilNum + Instordb.RecoilNum;



            return(await InStorRepository.UpdateAsync(dtos).ConfigureAwait(false));
        }