コード例 #1
0
        public async Task <ActionResult <Contact_DirectSalesOrderDTO> > GetDirectSalesOrder([FromBody] Contact_DirectSalesOrderDTO Contact_DirectSalesOrderDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            DirectSalesOrder DirectSalesOrder = await DirectSalesOrderService.Get(Contact_DirectSalesOrderDTO.Id);

            return(new Contact_DirectSalesOrderDTO(DirectSalesOrder));
        }
コード例 #2
0
 public DirectSalesOrder_PrintDTO(DirectSalesOrder DirectSalesOrder)
 {
     this.Id                    = DirectSalesOrder.Id;
     this.Code                  = DirectSalesOrder.Code;
     this.PhoneNumber           = DirectSalesOrder.PhoneNumber;
     this.StoreAddress          = DirectSalesOrder.StoreAddress;
     this.DeliveryAddress       = DirectSalesOrder.DeliveryAddress;
     this.OrderDate             = DirectSalesOrder.OrderDate;
     this.DeliveryDate          = DirectSalesOrder.DeliveryDate;
     this.SubTotal              = DirectSalesOrder.SubTotal;
     this.GeneralDiscountAmount = DirectSalesOrder.GeneralDiscountAmount;
     this.TotalTaxAmount        = DirectSalesOrder.TotalTaxAmount;
     this.Total                 = DirectSalesOrder.Total;
     this.BuyerStore            = DirectSalesOrder.BuyerStore == null ? null : new DirectSalesOrder_StoreDTO(DirectSalesOrder.BuyerStore);
     this.SaleEmployee          = DirectSalesOrder.SaleEmployee == null ? null : new DirectSalesOrder_AppUserDTO(DirectSalesOrder.SaleEmployee);
     this.Contents              = DirectSalesOrder.DirectSalesOrderContents?.Select(x => new DirectSalesOrder_PrintContentDTO(x)).ToList();
     this.Promotions            = DirectSalesOrder.DirectSalesOrderPromotions?.Select(x => new DirectSalesOrder_PrintPromotionDTO(x)).ToList();
     this.Errors                = DirectSalesOrder.Errors;
 }
コード例 #3
0
 private void ClearCurrent()
 {
     this.dsOrder = null;
     this._Id     = Guid.NewGuid();
     this._ListDirectSalesDetail.Clear();
     this.FStatus.FStatus   = FormStatusEnum.New;
     this._PurchaseUnit     = null;
     this._SupplyUnit       = null;
     this.textBox1.Text     = this.textBox2.Text = this.textBox3.Text = string.Empty;
     this.textBox4.Text     = this.textBox5.Text = string.Empty;
     this.label5.Text       = this.label2.Text = "无";
     this.label6.Text       = "地址:";
     this.label7.Text       = "联系电话:";
     this.label10.Text      = "负责人:";
     this.label11.Text      = "企业法人:";
     this.richTextBox1.Text = string.Empty;
     this.GetDirectSalesOrderUnapproved();
     this.dataGridView1.Refresh();
 }
コード例 #4
0
        public async Task <bool> ValidateId(DirectSalesOrder DirectSalesOrder)
        {
            DirectSalesOrderFilter DirectSalesOrderFilter = new DirectSalesOrderFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = DirectSalesOrder.Id
                },
                Selects = DirectSalesOrderSelect.Id
            };

            int count = await UOW.DirectSalesOrderRepository.Count(DirectSalesOrderFilter);

            if (count == 0)
            {
                DirectSalesOrder.AddError(nameof(DirectSalesOrderValidator), nameof(DirectSalesOrder.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }
コード例 #5
0
        private DirectSalesOrder ConvertDTOToEntity(DirectSalesOrder_DirectSalesOrderDTO DirectSalesOrder_DirectSalesOrderDTO)
        {
            DirectSalesOrder DirectSalesOrder = new DirectSalesOrder();

            DirectSalesOrder.Id                        = DirectSalesOrder_DirectSalesOrderDTO.Id;
            DirectSalesOrder.Code                      = DirectSalesOrder_DirectSalesOrderDTO.Code;
            DirectSalesOrder.BuyerStoreId              = DirectSalesOrder_DirectSalesOrderDTO.BuyerStoreId;
            DirectSalesOrder.PhoneNumber               = DirectSalesOrder_DirectSalesOrderDTO.PhoneNumber;
            DirectSalesOrder.StoreAddress              = DirectSalesOrder_DirectSalesOrderDTO.StoreAddress;
            DirectSalesOrder.DeliveryAddress           = DirectSalesOrder_DirectSalesOrderDTO.DeliveryAddress;
            DirectSalesOrder.SaleEmployeeId            = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployeeId;
            DirectSalesOrder.OrganizationId            = DirectSalesOrder_DirectSalesOrderDTO.OrganizationId;
            DirectSalesOrder.OrderDate                 = DirectSalesOrder_DirectSalesOrderDTO.OrderDate;
            DirectSalesOrder.DeliveryDate              = DirectSalesOrder_DirectSalesOrderDTO.DeliveryDate;
            DirectSalesOrder.RequestStateId            = DirectSalesOrder_DirectSalesOrderDTO.RequestStateId;
            DirectSalesOrder.EditedPriceStatusId       = DirectSalesOrder_DirectSalesOrderDTO.EditedPriceStatusId;
            DirectSalesOrder.Note                      = DirectSalesOrder_DirectSalesOrderDTO.Note;
            DirectSalesOrder.SubTotal                  = DirectSalesOrder_DirectSalesOrderDTO.SubTotal;
            DirectSalesOrder.GeneralDiscountPercentage = DirectSalesOrder_DirectSalesOrderDTO.GeneralDiscountPercentage;
            DirectSalesOrder.GeneralDiscountAmount     = DirectSalesOrder_DirectSalesOrderDTO.GeneralDiscountAmount;
            DirectSalesOrder.TotalTaxAmount            = DirectSalesOrder_DirectSalesOrderDTO.TotalTaxAmount;
            DirectSalesOrder.TotalAfterTax             = DirectSalesOrder_DirectSalesOrderDTO.TotalAfterTax;
            DirectSalesOrder.PromotionCode             = DirectSalesOrder_DirectSalesOrderDTO.PromotionCode;
            DirectSalesOrder.PromotionValue            = DirectSalesOrder_DirectSalesOrderDTO.PromotionValue;
            DirectSalesOrder.Total                     = DirectSalesOrder_DirectSalesOrderDTO.Total;
            DirectSalesOrder.BuyerStore                = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore == null ? null : new Store
            {
                Id                = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.Id,
                Code              = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.Code,
                Name              = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.Name,
                ParentStoreId     = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.ParentStoreId,
                OrganizationId    = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.OrganizationId,
                StoreTypeId       = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.StoreTypeId,
                StoreGroupingId   = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.StoreGroupingId,
                Telephone         = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.Telephone,
                ProvinceId        = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.ProvinceId,
                DistrictId        = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.DistrictId,
                WardId            = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.WardId,
                Address           = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.Address,
                DeliveryAddress   = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.DeliveryAddress,
                Latitude          = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.Latitude,
                Longitude         = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.Longitude,
                DeliveryLatitude  = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.DeliveryLatitude,
                DeliveryLongitude = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.DeliveryLongitude,
                OwnerName         = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.OwnerName,
                OwnerPhone        = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.OwnerPhone,
                OwnerEmail        = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.OwnerEmail,
                TaxCode           = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.TaxCode,
                LegalEntity       = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.LegalEntity,
                StatusId          = DirectSalesOrder_DirectSalesOrderDTO.BuyerStore.StatusId,
            };
            DirectSalesOrder.Organization = DirectSalesOrder_DirectSalesOrderDTO.Organization == null ? null : new Organization
            {
                Id       = DirectSalesOrder_DirectSalesOrderDTO.Organization.Id,
                Code     = DirectSalesOrder_DirectSalesOrderDTO.Organization.Code,
                Name     = DirectSalesOrder_DirectSalesOrderDTO.Organization.Name,
                ParentId = DirectSalesOrder_DirectSalesOrderDTO.Organization.ParentId,
                Path     = DirectSalesOrder_DirectSalesOrderDTO.Organization.Path,
                Level    = DirectSalesOrder_DirectSalesOrderDTO.Organization.Level,
                StatusId = DirectSalesOrder_DirectSalesOrderDTO.Organization.StatusId,
                Phone    = DirectSalesOrder_DirectSalesOrderDTO.Organization.Phone,
                Address  = DirectSalesOrder_DirectSalesOrderDTO.Organization.Address,
                Email    = DirectSalesOrder_DirectSalesOrderDTO.Organization.Email,
            };
            DirectSalesOrder.EditedPriceStatus = DirectSalesOrder_DirectSalesOrderDTO.EditedPriceStatus == null ? null : new EditedPriceStatus
            {
                Id   = DirectSalesOrder_DirectSalesOrderDTO.EditedPriceStatus.Id,
                Code = DirectSalesOrder_DirectSalesOrderDTO.EditedPriceStatus.Code,
                Name = DirectSalesOrder_DirectSalesOrderDTO.EditedPriceStatus.Name,
            };
            DirectSalesOrder.SaleEmployee = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee == null ? null : new AppUser
            {
                Id             = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.Id,
                Username       = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.Username,
                DisplayName    = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.DisplayName,
                Address        = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.Address,
                Email          = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.Email,
                Phone          = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.Phone,
                PositionId     = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.PositionId,
                Department     = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.Department,
                OrganizationId = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.OrganizationId,
                SexId          = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.SexId,
                StatusId       = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.StatusId,
                Avatar         = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.Avatar,
                Birthday       = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.Birthday,
                ProvinceId     = DirectSalesOrder_DirectSalesOrderDTO.SaleEmployee.ProvinceId,
            };
            DirectSalesOrder.DirectSalesOrderContents = DirectSalesOrder_DirectSalesOrderDTO.DirectSalesOrderContents?
                                                        .Select(x => new DirectSalesOrderContent
            {
                Id                        = x.Id,
                ItemId                    = x.ItemId,
                UnitOfMeasureId           = x.UnitOfMeasureId,
                Quantity                  = x.Quantity,
                PrimaryUnitOfMeasureId    = x.PrimaryUnitOfMeasureId,
                RequestedQuantity         = x.RequestedQuantity,
                PrimaryPrice              = x.PrimaryPrice,
                SalePrice                 = x.SalePrice,
                DiscountPercentage        = x.DiscountPercentage,
                DiscountAmount            = x.DiscountAmount,
                GeneralDiscountPercentage = x.GeneralDiscountPercentage,
                GeneralDiscountAmount     = x.GeneralDiscountAmount,
                Amount                    = x.Amount,
                TaxPercentage             = x.TaxPercentage,
                TaxAmount                 = x.TaxAmount,
                Factor                    = x.Factor,
                Item                      = x.Item == null ? null : new Item
                {
                    Id          = x.Item.Id,
                    Code        = x.Item.Code,
                    Name        = x.Item.Name,
                    ProductId   = x.Item.ProductId,
                    RetailPrice = x.Item.RetailPrice,
                    SalePrice   = x.Item.SalePrice,
                    SaleStock   = x.Item.SaleStock,
                    ScanCode    = x.Item.ScanCode,
                    StatusId    = x.Item.StatusId,
                    Product     = x.Item.Product == null ? null : new Product
                    {
                        Id                      = x.Item.Product.Id,
                        Code                    = x.Item.Product.Code,
                        SupplierCode            = x.Item.Product.SupplierCode,
                        Name                    = x.Item.Product.Name,
                        Description             = x.Item.Product.Description,
                        ScanCode                = x.Item.Product.ScanCode,
                        ProductTypeId           = x.Item.Product.ProductTypeId,
                        SupplierId              = x.Item.Product.SupplierId,
                        BrandId                 = x.Item.Product.BrandId,
                        UnitOfMeasureId         = x.Item.Product.UnitOfMeasureId,
                        UnitOfMeasureGroupingId = x.Item.Product.UnitOfMeasureGroupingId,
                        RetailPrice             = x.Item.Product.RetailPrice,
                        TaxTypeId               = x.Item.Product.TaxTypeId,
                        StatusId                = x.Item.Product.StatusId,
                        ProductType             = x.Item.Product.ProductType == null ? null : new ProductType
                        {
                            Id          = x.Item.Product.ProductType.Id,
                            Code        = x.Item.Product.ProductType.Code,
                            Name        = x.Item.Product.ProductType.Name,
                            Description = x.Item.Product.ProductType.Description,
                            StatusId    = x.Item.Product.ProductType.StatusId,
                        },
                        TaxType = x.Item.Product.TaxType == null ? null : new TaxType
                        {
                            Id         = x.Item.Product.TaxType.Id,
                            Code       = x.Item.Product.TaxType.Code,
                            StatusId   = x.Item.Product.TaxType.StatusId,
                            Name       = x.Item.Product.TaxType.Name,
                            Percentage = x.Item.Product.TaxType.Percentage,
                        },
                        UnitOfMeasure = x.Item.Product.UnitOfMeasure == null ? null : new UnitOfMeasure
                        {
                            Id          = x.Item.Product.UnitOfMeasure.Id,
                            Code        = x.Item.Product.UnitOfMeasure.Code,
                            Name        = x.Item.Product.UnitOfMeasure.Name,
                            Description = x.Item.Product.UnitOfMeasure.Description,
                            StatusId    = x.Item.Product.UnitOfMeasure.StatusId,
                        },
                        UnitOfMeasureGrouping = x.Item.Product.UnitOfMeasureGrouping == null ? null : new UnitOfMeasureGrouping
                        {
                            Id              = x.Item.Product.UnitOfMeasureGrouping.Id,
                            Code            = x.Item.Product.UnitOfMeasureGrouping.Code,
                            Name            = x.Item.Product.UnitOfMeasureGrouping.Name,
                            Description     = x.Item.Product.UnitOfMeasureGrouping.Description,
                            UnitOfMeasureId = x.Item.Product.UnitOfMeasureGrouping.UnitOfMeasureId,
                        },
                    }
                },
                PrimaryUnitOfMeasure = x.PrimaryUnitOfMeasure == null ? null : new UnitOfMeasure
                {
                    Id          = x.PrimaryUnitOfMeasure.Id,
                    Code        = x.PrimaryUnitOfMeasure.Code,
                    Name        = x.PrimaryUnitOfMeasure.Name,
                    Description = x.PrimaryUnitOfMeasure.Description,
                    StatusId    = x.PrimaryUnitOfMeasure.StatusId,
                },
                UnitOfMeasure = x.UnitOfMeasure == null ? null : new UnitOfMeasure
                {
                    Id          = x.UnitOfMeasure.Id,
                    Code        = x.UnitOfMeasure.Code,
                    Name        = x.UnitOfMeasure.Name,
                    Description = x.UnitOfMeasure.Description,
                    StatusId    = x.UnitOfMeasure.StatusId,
                },
            }).ToList();
            DirectSalesOrder.DirectSalesOrderPromotions = DirectSalesOrder_DirectSalesOrderDTO.DirectSalesOrderPromotions?
                                                          .Select(x => new DirectSalesOrderPromotion
            {
                Id                     = x.Id,
                ItemId                 = x.ItemId,
                UnitOfMeasureId        = x.UnitOfMeasureId,
                Quantity               = x.Quantity,
                PrimaryUnitOfMeasureId = x.PrimaryUnitOfMeasureId,
                RequestedQuantity      = x.RequestedQuantity,
                Note                   = x.Note,
                Factor                 = x.Factor,
                Item                   = x.Item == null ? null : new Item
                {
                    Id          = x.Item.Id,
                    ProductId   = x.Item.ProductId,
                    Code        = x.Item.Code,
                    Name        = x.Item.Name,
                    ScanCode    = x.Item.ScanCode,
                    SalePrice   = x.Item.SalePrice,
                    RetailPrice = x.Item.RetailPrice,
                    StatusId    = x.Item.StatusId,
                    SaleStock   = x.Item.SaleStock,
                    Product     = x.Item.Product == null ? null : new Product
                    {
                        Id                      = x.Item.Product.Id,
                        Code                    = x.Item.Product.Code,
                        SupplierCode            = x.Item.Product.SupplierCode,
                        Name                    = x.Item.Product.Name,
                        Description             = x.Item.Product.Description,
                        ScanCode                = x.Item.Product.ScanCode,
                        ProductTypeId           = x.Item.Product.ProductTypeId,
                        SupplierId              = x.Item.Product.SupplierId,
                        BrandId                 = x.Item.Product.BrandId,
                        UnitOfMeasureId         = x.Item.Product.UnitOfMeasureId,
                        UnitOfMeasureGroupingId = x.Item.Product.UnitOfMeasureGroupingId,
                        RetailPrice             = x.Item.Product.RetailPrice,
                        TaxTypeId               = x.Item.Product.TaxTypeId,
                        StatusId                = x.Item.Product.StatusId,
                        ProductType             = x.Item.Product.ProductType == null ? null : new ProductType
                        {
                            Id          = x.Item.Product.ProductType.Id,
                            Code        = x.Item.Product.ProductType.Code,
                            Name        = x.Item.Product.ProductType.Name,
                            Description = x.Item.Product.ProductType.Description,
                            StatusId    = x.Item.Product.ProductType.StatusId,
                        },
                        TaxType = x.Item.Product.TaxType == null ? null : new TaxType
                        {
                            Id         = x.Item.Product.TaxType.Id,
                            Code       = x.Item.Product.TaxType.Code,
                            StatusId   = x.Item.Product.TaxType.StatusId,
                            Name       = x.Item.Product.TaxType.Name,
                            Percentage = x.Item.Product.TaxType.Percentage,
                        },
                        UnitOfMeasure = x.Item.Product.UnitOfMeasure == null ? null : new UnitOfMeasure
                        {
                            Id          = x.Item.Product.UnitOfMeasure.Id,
                            Code        = x.Item.Product.UnitOfMeasure.Code,
                            Name        = x.Item.Product.UnitOfMeasure.Name,
                            Description = x.Item.Product.UnitOfMeasure.Description,
                            StatusId    = x.Item.Product.UnitOfMeasure.StatusId,
                        },
                        UnitOfMeasureGrouping = x.Item.Product.UnitOfMeasureGrouping == null ? null : new UnitOfMeasureGrouping
                        {
                            Id              = x.Item.Product.UnitOfMeasureGrouping.Id,
                            Code            = x.Item.Product.UnitOfMeasureGrouping.Code,
                            Name            = x.Item.Product.UnitOfMeasureGrouping.Name,
                            Description     = x.Item.Product.UnitOfMeasureGrouping.Description,
                            UnitOfMeasureId = x.Item.Product.UnitOfMeasureGrouping.UnitOfMeasureId,
                        },
                    }
                },
                PrimaryUnitOfMeasure = x.PrimaryUnitOfMeasure == null ? null : new UnitOfMeasure
                {
                    Id          = x.PrimaryUnitOfMeasure.Id,
                    Code        = x.PrimaryUnitOfMeasure.Code,
                    Name        = x.PrimaryUnitOfMeasure.Name,
                    Description = x.PrimaryUnitOfMeasure.Description,
                    StatusId    = x.PrimaryUnitOfMeasure.StatusId,
                },
                UnitOfMeasure = x.UnitOfMeasure == null ? null : new UnitOfMeasure
                {
                    Id          = x.UnitOfMeasure.Id,
                    Code        = x.UnitOfMeasure.Code,
                    Name        = x.UnitOfMeasure.Name,
                    Description = x.UnitOfMeasure.Description,
                    StatusId    = x.UnitOfMeasure.StatusId,
                },
            }).ToList();
            DirectSalesOrder.BaseLanguage = CurrentContext.Language;
            return(DirectSalesOrder);
        }
コード例 #6
0
        public async Task <DirectSalesOrder> Get(long Id)
        {
            DirectSalesOrder DirectSalesOrder = await DataContext.DirectSalesOrder.AsNoTracking()
                                                .Where(x => x.Id == Id).Select(x => new DirectSalesOrder()
            {
                Id                        = x.Id,
                Code                      = x.Code,
                OrganizationId            = x.OrganizationId,
                BuyerStoreId              = x.BuyerStoreId,
                PhoneNumber               = x.PhoneNumber,
                StoreAddress              = x.StoreAddress,
                DeliveryAddress           = x.DeliveryAddress,
                SaleEmployeeId            = x.SaleEmployeeId,
                OrderDate                 = x.OrderDate,
                CreatedAt                 = x.CreatedAt,
                UpdatedAt                 = x.UpdatedAt,
                DeliveryDate              = x.DeliveryDate,
                EditedPriceStatusId       = x.EditedPriceStatusId,
                Note                      = x.Note,
                RequestStateId            = x.RequestStateId,
                SubTotal                  = x.SubTotal,
                GeneralDiscountPercentage = x.GeneralDiscountPercentage,
                GeneralDiscountAmount     = x.GeneralDiscountAmount,
                PromotionCode             = x.PromotionCode,
                PromotionValue            = x.PromotionValue,
                TotalTaxAmount            = x.TotalTaxAmount,
                TotalAfterTax             = x.TotalAfterTax,
                Total                     = x.Total,
                RowId                     = x.RowId,
                BuyerStore                = x.BuyerStore == null ? null : new Store
                {
                    Id                = x.BuyerStore.Id,
                    Code              = x.BuyerStore.Code,
                    CodeDraft         = x.BuyerStore.CodeDraft,
                    Name              = x.BuyerStore.Name,
                    ParentStoreId     = x.BuyerStore.ParentStoreId,
                    OrganizationId    = x.BuyerStore.OrganizationId,
                    StoreTypeId       = x.BuyerStore.StoreTypeId,
                    StoreGroupingId   = x.BuyerStore.StoreGroupingId,
                    Telephone         = x.BuyerStore.Telephone,
                    ProvinceId        = x.BuyerStore.ProvinceId,
                    DistrictId        = x.BuyerStore.DistrictId,
                    WardId            = x.BuyerStore.WardId,
                    Address           = x.BuyerStore.Address,
                    DeliveryAddress   = x.BuyerStore.DeliveryAddress,
                    Latitude          = x.BuyerStore.Latitude,
                    Longitude         = x.BuyerStore.Longitude,
                    DeliveryLatitude  = x.BuyerStore.DeliveryLatitude,
                    DeliveryLongitude = x.BuyerStore.DeliveryLongitude,
                    OwnerName         = x.BuyerStore.OwnerName,
                    OwnerPhone        = x.BuyerStore.OwnerPhone,
                    OwnerEmail        = x.BuyerStore.OwnerEmail,
                    TaxCode           = x.BuyerStore.TaxCode,
                    LegalEntity       = x.BuyerStore.LegalEntity,
                    StatusId          = x.BuyerStore.StatusId,
                },
                EditedPriceStatus = x.EditedPriceStatus == null ? null : new EditedPriceStatus
                {
                    Id   = x.EditedPriceStatus.Id,
                    Code = x.EditedPriceStatus.Code,
                    Name = x.EditedPriceStatus.Name,
                },
                Organization = x.Organization == null ? null : new Organization
                {
                    Id       = x.Organization.Id,
                    Code     = x.Organization.Code,
                    Name     = x.Organization.Name,
                    Address  = x.Organization.Address,
                    Phone    = x.Organization.Phone,
                    Path     = x.Organization.Path,
                    ParentId = x.Organization.ParentId,
                    Email    = x.Organization.Email,
                    StatusId = x.Organization.StatusId,
                    Level    = x.Organization.Level
                },
                RequestState = x.RequestState == null ? null : new RequestState
                {
                    Id   = x.RequestState.Id,
                    Code = x.RequestState.Code,
                    Name = x.RequestState.Name,
                },
                SaleEmployee = x.SaleEmployee == null ? null : new AppUser
                {
                    Id          = x.SaleEmployee.Id,
                    Username    = x.SaleEmployee.Username,
                    DisplayName = x.SaleEmployee.DisplayName,
                    Address     = x.SaleEmployee.Address,
                    Email       = x.SaleEmployee.Email,
                    Phone       = x.SaleEmployee.Phone,
                },
            }).FirstOrDefaultAsync();

            if (DirectSalesOrder == null)
            {
                return(null);
            }

            RequestWorkflowDefinitionMappingDAO RequestWorkflowDefinitionMappingDAO = await DataContext.RequestWorkflowDefinitionMapping
                                                                                      .Where(x => DirectSalesOrder.RowId == x.RequestId)
                                                                                      .Include(x => x.RequestState)
                                                                                      .AsNoTracking()
                                                                                      .FirstOrDefaultAsync();

            if (RequestWorkflowDefinitionMappingDAO != null)
            {
                DirectSalesOrder.RequestStateId = RequestWorkflowDefinitionMappingDAO.RequestStateId;
                DirectSalesOrder.RequestState   = new RequestState
                {
                    Id   = RequestWorkflowDefinitionMappingDAO.RequestState.Id,
                    Code = RequestWorkflowDefinitionMappingDAO.RequestState.Code,
                    Name = RequestWorkflowDefinitionMappingDAO.RequestState.Name,
                };
            }

            DirectSalesOrder.DirectSalesOrderContents = await DataContext.DirectSalesOrderContent.AsNoTracking()
                                                        .Where(x => x.DirectSalesOrderId == DirectSalesOrder.Id)
                                                        .Select(x => new DirectSalesOrderContent
            {
                Id = x.Id,
                DirectSalesOrderId        = x.DirectSalesOrderId,
                ItemId                    = x.ItemId,
                UnitOfMeasureId           = x.UnitOfMeasureId,
                Quantity                  = x.Quantity,
                PrimaryUnitOfMeasureId    = x.PrimaryUnitOfMeasureId,
                RequestedQuantity         = x.RequestedQuantity,
                PrimaryPrice              = x.PrimaryPrice,
                SalePrice                 = x.SalePrice,
                EditedPriceStatusId       = x.EditedPriceStatusId,
                DiscountPercentage        = x.DiscountPercentage,
                DiscountAmount            = x.DiscountAmount,
                GeneralDiscountPercentage = x.GeneralDiscountPercentage,
                GeneralDiscountAmount     = x.GeneralDiscountAmount,
                Amount                    = x.Amount,
                TaxPercentage             = x.TaxPercentage,
                TaxAmount                 = x.TaxAmount,
                Factor                    = x.Factor,
                EditedPriceStatus         = x.EditedPriceStatus == null ? null : new EditedPriceStatus
                {
                    Id   = x.EditedPriceStatus.Id,
                    Code = x.EditedPriceStatus.Code,
                    Name = x.EditedPriceStatus.Name,
                },
                Item = new Item
                {
                    Id          = x.Item.Id,
                    Code        = x.Item.Code,
                    Name        = x.Item.Name,
                    ProductId   = x.Item.ProductId,
                    RetailPrice = x.Item.RetailPrice,
                    SalePrice   = x.Item.SalePrice,
                    ScanCode    = x.Item.ScanCode,
                    StatusId    = x.Item.StatusId,
                    Product     = new Product
                    {
                        Id                      = x.Item.Product.Id,
                        Code                    = x.Item.Product.Code,
                        Name                    = x.Item.Product.Name,
                        TaxTypeId               = x.Item.Product.TaxTypeId,
                        UnitOfMeasureId         = x.Item.Product.UnitOfMeasureId,
                        UnitOfMeasureGroupingId = x.Item.Product.UnitOfMeasureGroupingId,
                        TaxType                 = new TaxType
                        {
                            Id         = x.Item.Product.TaxType.Id,
                            Code       = x.Item.Product.TaxType.Code,
                            Name       = x.Item.Product.TaxType.Name,
                            StatusId   = x.Item.Product.TaxType.StatusId,
                            Percentage = x.Item.Product.TaxType.Percentage,
                        },
                        UnitOfMeasure = new UnitOfMeasure
                        {
                            Id          = x.Item.Product.UnitOfMeasure.Id,
                            Code        = x.Item.Product.UnitOfMeasure.Code,
                            Name        = x.Item.Product.UnitOfMeasure.Name,
                            Description = x.Item.Product.UnitOfMeasure.Description,
                            StatusId    = x.Item.Product.UnitOfMeasure.StatusId,
                        },
                        UnitOfMeasureGrouping = new UnitOfMeasureGrouping
                        {
                            Id              = x.Item.Product.UnitOfMeasureGrouping.Id,
                            Code            = x.Item.Product.UnitOfMeasureGrouping.Code,
                            Name            = x.Item.Product.UnitOfMeasureGrouping.Name,
                            Description     = x.Item.Product.UnitOfMeasureGrouping.Description,
                            StatusId        = x.Item.Product.UnitOfMeasureGrouping.StatusId,
                            UnitOfMeasureId = x.Item.Product.UnitOfMeasureGrouping.UnitOfMeasureId
                        }
                    }
                },
                PrimaryUnitOfMeasure = new UnitOfMeasure
                {
                    Id          = x.PrimaryUnitOfMeasure.Id,
                    Code        = x.PrimaryUnitOfMeasure.Code,
                    Name        = x.PrimaryUnitOfMeasure.Name,
                    Description = x.PrimaryUnitOfMeasure.Description,
                    StatusId    = x.PrimaryUnitOfMeasure.StatusId,
                },
                UnitOfMeasure = new UnitOfMeasure
                {
                    Id          = x.UnitOfMeasure.Id,
                    Code        = x.UnitOfMeasure.Code,
                    Name        = x.UnitOfMeasure.Name,
                    Description = x.UnitOfMeasure.Description,
                    StatusId    = x.UnitOfMeasure.StatusId,
                },
            }).ToListAsync();

            DirectSalesOrder.DirectSalesOrderPromotions = await DataContext.DirectSalesOrderPromotion.AsNoTracking()
                                                          .Where(x => x.DirectSalesOrderId == DirectSalesOrder.Id)
                                                          .Select(x => new DirectSalesOrderPromotion
            {
                Id = x.Id,
                DirectSalesOrderId     = x.DirectSalesOrderId,
                ItemId                 = x.ItemId,
                UnitOfMeasureId        = x.UnitOfMeasureId,
                Quantity               = x.Quantity,
                PrimaryUnitOfMeasureId = x.PrimaryUnitOfMeasureId,
                RequestedQuantity      = x.RequestedQuantity,
                Note   = x.Note,
                Factor = x.Factor,
                Item   = new Item
                {
                    Id          = x.Item.Id,
                    Code        = x.Item.Code,
                    Name        = x.Item.Name,
                    ProductId   = x.Item.ProductId,
                    RetailPrice = x.Item.RetailPrice,
                    SalePrice   = x.Item.SalePrice,
                    ScanCode    = x.Item.ScanCode,
                    StatusId    = x.Item.StatusId,
                    Product     = new Product
                    {
                        Id                      = x.Item.Product.Id,
                        Code                    = x.Item.Product.Code,
                        Name                    = x.Item.Product.Name,
                        TaxTypeId               = x.Item.Product.TaxTypeId,
                        UnitOfMeasureId         = x.Item.Product.UnitOfMeasureId,
                        UnitOfMeasureGroupingId = x.Item.Product.UnitOfMeasureGroupingId,
                        TaxType                 = new TaxType
                        {
                            Id         = x.Item.Product.TaxType.Id,
                            Code       = x.Item.Product.TaxType.Code,
                            Name       = x.Item.Product.TaxType.Name,
                            StatusId   = x.Item.Product.TaxType.StatusId,
                            Percentage = x.Item.Product.TaxType.Percentage,
                        },
                        UnitOfMeasure = new UnitOfMeasure
                        {
                            Id          = x.Item.Product.UnitOfMeasure.Id,
                            Code        = x.Item.Product.UnitOfMeasure.Code,
                            Name        = x.Item.Product.UnitOfMeasure.Name,
                            Description = x.Item.Product.UnitOfMeasure.Description,
                            StatusId    = x.Item.Product.UnitOfMeasure.StatusId,
                        },
                        UnitOfMeasureGrouping = new UnitOfMeasureGrouping
                        {
                            Id              = x.Item.Product.UnitOfMeasureGrouping.Id,
                            Code            = x.Item.Product.UnitOfMeasureGrouping.Code,
                            Name            = x.Item.Product.UnitOfMeasureGrouping.Name,
                            Description     = x.Item.Product.UnitOfMeasureGrouping.Description,
                            StatusId        = x.Item.Product.UnitOfMeasureGrouping.StatusId,
                            UnitOfMeasureId = x.Item.Product.UnitOfMeasureGrouping.UnitOfMeasureId
                        }
                    }
                },
                PrimaryUnitOfMeasure = new UnitOfMeasure
                {
                    Id          = x.PrimaryUnitOfMeasure.Id,
                    Code        = x.PrimaryUnitOfMeasure.Code,
                    Name        = x.PrimaryUnitOfMeasure.Name,
                    Description = x.PrimaryUnitOfMeasure.Description,
                    StatusId    = x.PrimaryUnitOfMeasure.StatusId,
                },
                UnitOfMeasure = new UnitOfMeasure
                {
                    Id          = x.UnitOfMeasure.Id,
                    Code        = x.UnitOfMeasure.Code,
                    Name        = x.UnitOfMeasure.Name,
                    Description = x.UnitOfMeasure.Description,
                    StatusId    = x.UnitOfMeasure.StatusId,
                },
            }).ToListAsync();

            decimal GeneralDiscountAmount = DirectSalesOrder.GeneralDiscountAmount.HasValue ? DirectSalesOrder.GeneralDiscountAmount.Value : 0;
            decimal DiscountAmount        = DirectSalesOrder.DirectSalesOrderContents != null?
                                            DirectSalesOrder.DirectSalesOrderContents
                                            .Select(x => x.DiscountAmount.GetValueOrDefault(0))
                                            .Sum() : 0;

            DirectSalesOrder.TotalDiscountAmount    = GeneralDiscountAmount + DiscountAmount;
            DirectSalesOrder.TotalRequestedQuantity = DirectSalesOrder.DirectSalesOrderContents != null?
                                                      DirectSalesOrder.DirectSalesOrderContents
                                                      .Select(x => x.RequestedQuantity)
                                                      .Sum() : 0;

            return(DirectSalesOrder);
        }
コード例 #7
0
 public async Task <bool> Create(DirectSalesOrder DirectSalesOrder)
 {
     return(DirectSalesOrder.IsValidated);
 }
コード例 #8
0
        /// <summary>
        /// 根据审核结果更新实体审核信息
        /// 对业务表的操作:审批同意且审批节点流完,需要更新业务表 后者审批拒绝需要更新业务表
        /// </summary>
        /// <param name="flowTypeIndex"></param>
        /// <param name="flowId"></param>
        /// <param name="status"></param>
        private void UpdateEntityByApprovalStatus(int flowTypeIndex, Guid flowId, ApprovalStatus status)
        {
            try
            {
                switch (flowTypeIndex)
                {
                case (int)ApprovalType.SupplyUnitApproval:
                case (int)ApprovalType.SupplyUnitEditApproval:
                case (int)ApprovalType.SupplyUnitLockApproval:
                    SupplyUnit su = new SupplyUnit();
                    su = (SupplyUnit)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (su == null)     //测试时可能为NULL
                    {
                        BusinessHandlerFactory.SupplyUnitBusinessHandler.Save(su);
                    }
                    break;

                case (int)ApprovalType.DrugInfoApproval:
                case (int)ApprovalType.DrugInfoEditApproval:
                case (int)ApprovalType.DrugInfoLockApproval:
                    DrugInfo di = new DrugInfo();
                    di = (DrugInfo)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (di == null)     //测试时可能为NULL
                    {
                        BusinessHandlerFactory.DrugInfoBusinessHandler.Save(di);
                    }
                    break;

                case (int)ApprovalType.PurchaseUnitApproval:
                case (int)ApprovalType.PurchaseUnitEditApproval:
                case (int)ApprovalType.PurchaseUnitLockApproval:
                    PurchaseUnit pu = new PurchaseUnit();
                    pu = (PurchaseUnit)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (pu == null)     //测试时可能为NULL
                    {
                        BusinessHandlerFactory.PurchaseUnitBusinessHandler.Save(pu);
                    }
                    break;

                case (int)ApprovalType.drugsUnqualityApproval:
                    DrugsUnqualication du = (DrugsUnqualication)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    BusinessHandlerFactory.DrugsUnqualicationBusinessHandler.Save(du);
                    break;

                case (int)ApprovalType.drugsBreakageApproval:
                    DrugsBreakage db = (DrugsBreakage)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (db == null)     //测试时可能为NULL
                    {
                        if (status == ApprovalStatus.Reject)
                        {
                            db.Deleted        = true;
                            db.DeleteTime     = DateTime.Now;
                            db.ApprovalStatus = ApprovalStatus.Reject;
                        }
                        BusinessHandlerFactory.DrugsBreakageBusinessHandler.Save(db);
                    }
                    break;

                case (int)ApprovalType.drugsInventoryMove:
                    DrugsInventoryMove dim = (DrugsInventoryMove)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (status == ApprovalStatus.Approvaled)
                    {
                        DrugInventoryRecord dir = BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Get(dim.inventoryRecordID);
                        dir.WarehouseZoneId = dim.WareHouseID;
                        BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Save(dir);
                    }
                    BusinessHandlerFactory.DrugsInventoryMoveBusinessHandler.Save(dim);
                    break;

                case (int)ApprovalType.VehicleApproval:
                    Vehicle v = (Vehicle)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    BusinessHandlerFactory.VehicleBusinessHandler.Save(v);
                    break;

                case (int)ApprovalType.DirectSalesApproval:
                    DirectSalesOrder dso = (Models.DirectSalesOrder)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    BusinessHandlerFactory.DirectSalesOrderBusinessHandler.Save(dso);
                    break;
                }
            }
            catch (Exception ex)
            {
                this.HandleException("根据审核结果更新实体审核信息失败", ex);
            }
        }
コード例 #9
0
        /// <summary>
        /// 打开详细的审批对象信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvApprovalList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }

                //加入详细画面
                if (dgvApprovalList.Columns[e.ColumnIndex].Name == "查看详细")
                {
                    if (dgvApprovalList.Rows[e.RowIndex].Cells[4].Value != null)
                    {
                        string msg = string.Empty;
                        Models.ApprovalFlow flow     = _approveFlowList[e.RowIndex];
                        ApprovalFlowType    flowType = PharmacyDatabaseService.GetApprovalFlowType(out msg, flow.ApprovalFlowTypeId);
                        switch (flowType.ApprovalTypeValue)
                        {
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.SupplyUnitApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.SupplyUnitEditApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.SupplyUnitLockApproval:
                            ucSupplyUnit uc = new ucSupplyUnit(flow.FlowId);
                            uc.Name = "DetailView";
                            this.plDetailView.Controls.Add(uc);
                            break;

                        case (int)BugsBox.Pharmacy.Models.ApprovalType.DrugInfoApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.DrugInfoEditApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.DrugInfoLockApproval:
                            DrugInfo di = this.PharmacyDatabaseService.GetDrugInfoByFlowID(out msg, flow.FlowId);
                            if (di.BusinessScopeCode.Contains("医疗器械"))
                            {
                                BaseDataManage.FormInstrument frmInstrument = new BaseDataManage.FormInstrument
                                {
                                    entity = di,
                                };
                                Common.SetControls.SetControlReadonly(frmInstrument, true);
                                frmInstrument.FSE = FormStatusEnum.Read;
                                frmInstrument.ShowDialog();
                                return;
                            }
                            else
                            {
                                ucGoodsInfo ucdi = new ucGoodsInfo(di);
                                Common.SetControls.SetControlReadonly(ucdi, true);
                                ucdi.Name = "DetailView";
                                this.plDetailView.Controls.Add(ucdi);
                            }
                            break;

                        case (int)BugsBox.Pharmacy.Models.ApprovalType.PurchaseUnitApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.PurchaseUnitEditApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.PurchaseUnitLockApproval:
                            ucPurchaseUnit ucpu = new ucPurchaseUnit(flow.FlowId);
                            ucpu.Name = "DetailView";
                            this.plDetailView.Controls.Add(ucpu);
                            break;

                        case (int)BugsBox.Pharmacy.Models.ApprovalType.drugsUnqualityApproval:
                            Business.Models.drugsUnqualificationQuery dq = PharmacyDatabaseService.getDrugsUnqualificationQueryByFlowID(flow.FlowId, out msg);
                            ucDrugsUnqualification ucdu = new ucDrugsUnqualification(dq);
                            ucdu.initApprovalDetail(flow.FlowId);
                            ucdu.Name = "DetailView";
                            this.plDetailView.Controls.Add(ucdu);
                            break;

                        case (int)ApprovalType.drugsBreakageApproval:
                            DrugsBreakage  db   = PharmacyDatabaseService.GetDrugsBreakageByFlowID(flow.FlowId, out msg);
                            UcDrugBreakage ucdb = new UcDrugBreakage(db, flow);
                            ucdb.Name = "DetailView";
                            this.plDetailView.Controls.Add(ucdb);
                            break;

                        case (int)ApprovalType.VehicleApproval:
                            Vehicle v = this.PharmacyDatabaseService.GetVehicleByFlowID(flow.FlowId, out msg);
                            if (v == null)
                            {
                                return;
                            }
                            DataDictionary.FormVehicleEdit frm = new DataDictionary.FormVehicleEdit(v, true);
                            frm.ShowDialog();
                            return;

                        case (int)ApprovalType.DirectSalesApproval:
                            DirectSalesOrder dso  = this.PharmacyDatabaseService.GetDirectSalesOrderByFlowId(flow.FlowId, out msg);
                            UCDirectSales    UCDS = new UCDirectSales(dso);
                            UCDS.Name = "DetailView";
                            this.plDetailView.Controls.Add(UCDS);
                            break;
                        }
                    }

                    //显示详细
                    this.plDetailView.BringToFront();
                    this.plDetailView.Visible = true;
                }
                else //打开详细流程记录, 审批流程表(上表)里的一条被选中后,把详细审批过程写入审批流程详细表(下表)
                {
                    dgvApprovalList_RowEnter(sender, e);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #10
0
        //暂存
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            this.dataGridView1.EndEdit();

            if (string.IsNullOrEmpty(this.richTextBox1.Text.Trim()))
            {
                MessageBox.Show("请填写直调申请说明!"); return;
            }

            if (this._SupplyUnit == null || this._PurchaseUnit == null || this._ListDirectSalesDetail.Count <= 0)
            {
                MessageBox.Show("请选择完整的直调供货单位或者购货单位信息!"); return;
            }

            if (string.IsNullOrEmpty(this.textBox5.Text) && string.IsNullOrEmpty(this.textBox4.Text))
            {
                string checkermsg = this.toolStripComboBox1.SelectedIndex == (int)DirectSaleType.直调委托验收?"直调委托验收员":checkermsg = "直调派驻验收员";
                MessageBox.Show("请填写" + checkermsg + "信息!"); return;
            }

            #region 检查提交的品种信息
            if (this._ListDirectSalesDetail == null)
            {
                MessageBox.Show("请选择直调药品!");
            }
            else
            {
                int count = 1;
                this._ListDirectSalesDetail.ForEach(r => { r.Sequence = count; count++; });
                var check = this._ListDirectSalesDetail.Where(r => r.Amount <= 0 || r.SalePrice <= 0 || r.SaleWholePrice <= 0 || r.SupplyPrice <= 0 || r.SupplyWholePrice <= 0);
                if (check.Count() > 0)
                {
                    MessageBox.Show("请检查,有未填写完整的信息!" + "品名:" + check.First().ProducGeneralName);
                    return;
                }
            }
            #endregion

            var s = from i in this._ListDirectSalesDetail
                    select new Models.DirectSalesOrderDetail
            {
                Amount             = i.Amount,
                DirectSaleDiff     = (i.SalePrice - i.SupplyPrice) * i.Amount,
                UnQualityAmount    = 0m,
                SalePrice          = i.SalePrice,
                SupplyPrice        = i.SupplyPrice,
                ProductDate        = DateTime.Now,
                QualityAmount      = 0m,
                DrugInfoId         = i.DrugInfoId,
                DirectSalesOrderId = this._Id,
                OutValidDate       = DateTime.Now,
                Id      = i.Id,
                Squence = i.Sequence,
            };

            if (((ToolStripButton)sender).Name == this.toolStripButton2.Name)
            {
                dsOrder = new DirectSalesOrder();
                dsOrder.CreateUserId        = BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id;
                dsOrder.CheckUserId         = Guid.Empty;
                dsOrder.ApprovalStatusValue = (int)ApprovalStatus.NonApproval;
                dsOrder.ApprovalUserId      = Guid.Empty;
                dsOrder.FlowId                  = Guid.NewGuid();
                dsOrder.Id                      = this._Id;
                dsOrder.PurchaseUnitId          = this._PurchaseUnit.Id;
                dsOrder.SupplyUnitId            = this._SupplyUnit.Id;
                dsOrder.UpdateUserId            = BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id;
                dsOrder.ApprovalDateTime        = DateTime.Now;
                dsOrder.CheckUserName           = this.toolStripComboBox1.SelectedIndex == (int)DirectSaleType.直调委托验收 ? this.textBox4.Text.Trim() : this.textBox5.Text.Trim();
                dsOrder.Memo                    = this.richTextBox1.Text.Trim();
                dsOrder.CheckStatusValue        = (int)DirectSalesSatus.UnChecked;
                dsOrder.DirectSalesOrderDetails = s.ToArray();
                if (this.PharmacyDatabaseService.AddDirectSalesOrderAndDetail(dsOrder, out msg))
                {
                    var c = this.PharmacyDatabaseService.GetDirectSalesOrder(dsOrder.Id, out msg);
                    MessageBox.Show("提交成功!单号:" + c.DocumentNumber);
                    this.PharmacyDatabaseService.WriteLog(dsOrder.CreateUserId, "成功提交销售直调单,单号:" + c.DocumentNumber);
                    this.ClearCurrent();
                }
                this.GetDirectSalesOrderUnapproved();
            }

            if (((ToolStripButton)sender).Name == this.toolStripButton4.Name)
            {
                this.dsOrder.UpdateUserId       = BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id;
                dsOrder.PurchaseUnitId          = this._PurchaseUnit.Id;
                dsOrder.SupplyUnitId            = this._SupplyUnit.Id;
                dsOrder.CheckUserName           = this.toolStripComboBox1.SelectedIndex == (int)DirectSaleType.直调委托验收 ? this.textBox4.Text.Trim() : this.textBox5.Text.Trim();
                dsOrder.DirectSalesOrderDetails = s.ToArray();
                dsOrder.Memo = this.richTextBox1.Text.Trim();
                if (this.PharmacyDatabaseService.SaveDirectSalesOrderAndDetail(dsOrder, out msg))
                {
                    MessageBox.Show("修改成功!单号:" + dsOrder.DocumentNumber);
                    this.PharmacyDatabaseService.WriteLog(dsOrder.CreateUserId, "成功修改销售直调单,单号:" + this.dsOrder.DocumentNumber);
                    this.ClearCurrent();
                }
                else
                {
                    MessageBox.Show("修改失败,请联系管理员!");
                }
            }
        }