public OPC_ShippingSale Create(DeliveryOrderCreationDTO deliveryOrderCreationDto)
        {
            var deliveryOrder = Create <DeliveryOrderCreationDTO>(deliveryOrderCreationDto);

            Compose(deliveryOrder);

            return(deliveryOrder);
        }
        /// <summary>
        /// 生成发货单
        /// </summary>
        private void OnDeliveryOrderCreate()
        {
            if (SalesOrdersForDelivery == null || !SalesOrdersForDelivery.Any())
            {
                MvvmUtility.ShowMessageAsync("请选择至少一个销售单", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            var selectedSalesOrdersForDelivery = SalesOrdersForDelivery.Where(salesOrder => salesOrder.IsSelected);

            if (!selectedSalesOrdersForDelivery.Any())
            {
                MvvmUtility.ShowMessageAsync("请选择至少一个销售单", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            if (selectedSalesOrdersForDelivery.Distinct(salesOrder => salesOrder.Order.OrderNo).Count() > 1)
            {
                MvvmUtility.ShowMessageAsync("所选择的销售单必须来自同一订单,否则无法生成发货单", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (selectedSalesOrdersForDelivery.Distinct(salesOrder => salesOrder.Order.CustomerName).Count() > 1 ||
                selectedSalesOrdersForDelivery.Distinct(salesOrder => salesOrder.Order.CustomerAddress).Count() > 1 ||
                selectedSalesOrdersForDelivery.Distinct(salesOrder => salesOrder.Order.CustomerPhone).Count() > 1)
            {
                MvvmUtility.ShowMessageAsync("所选择的销售单收货信息不一致,无法生成发货单", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            var firstSalesOrder = selectedSalesOrdersForDelivery.First();

            var deliveryOrderCreationDto = new DeliveryOrderCreationDTO()
            {
                SalesOrderNos = selectedSalesOrdersForDelivery.Select(salesOrder => salesOrder.SaleOrderNo).ToArray()
            };

            SalesOrdersForDelivery.SafelyRemove(salesOrder => salesOrder.IsSelected);

            var deliveryOrder = DeliveryOrderService.Create(deliveryOrderCreationDto);

            DeliveryOrders.SafelyInsert(0, deliveryOrder);
        }