Beispiel #1
0
        public async Task CreateHeader(CreateMachineRequirementDto input)
        {
            var @machinerequirement = input.MapTo <MachineRequirement>();

            @machinerequirement = MachineRequirement.Create(AbpSession.GetTenantId(), input.StyleNo, input.LineNo, input.Remark, input.FromDate, input.ToDate, input.LocationCode, input.StyleId);

            await _machineRequirementRepository.InsertAsync(@machinerequirement);
        }
Beispiel #2
0
        public async Task DuplicateEvent(CreateMachineRequirementDto input)
        {
            var @machinerequirement = input.MapTo <MachineRequirement>();

            @machinerequirement = MachineRequirement.Create(AbpSession.GetTenantId(), input.StyleNo, input.LineNo, input.Remark, input.FromDate, input.ToDate, input.LocationCode, input.StyleId);

            await _machineRequirementRepository.InsertAsync(@machinerequirement);

            await CurrentUnitOfWork.SaveChangesAsync();

            var @styleloading = _machineRequirementRepository
                                .GetAll()
                                .Include(x => x.MachineRequirementItems)
                                .Where(e => e.Id == input.Id)
                                .ToList().FirstOrDefault();

            var @lastcreatedevent = _machineRequirementRepository
                                    .GetAll()
                                    .OrderByDescending(x => x.CreationTime)
                                    .ToList().FirstOrDefault();

            var header = _machineRequirementRepository.Get(@lastcreatedevent.Id);


            foreach (var item in @styleloading.MachineRequirementItems)
            {
                var @machinerequirementitem = MachineRequirementItem.Create(item.MachineType, item.Nos, item.Remark);

                @machinerequirementitem.TenantId = AbpSession.GetTenantId();

                @machinerequirementitem.MachineRequirementId = @lastcreatedevent.Id;

                header.MachineRequirementItems.Add(machinerequirementitem);

                await CurrentUnitOfWork.SaveChangesAsync();
            }
        }