public async Task <bool> ReceiveHandOverBillLines(int billId, int[] lineIds)
        {
            var currentUser = await this.GetCurrentUserAsync();

            List <int>     receivedBillLineIds      = new List <int>();     //接口执行成功的交接单行
            List <dynamic> createCooperateParamList = new List <dynamic>(); //交接单行外协送出接口相关参数列表

            using (var uow = this.UnitOfWorkManager.Begin())
            {
                var bill = await this._handOverBillRepository.GetAll()
                           .Include(b => b.BillLines)
                           .FirstAsync(b => b.Id == billId);

                if (bill.BillState != HandOverBillState.Published)
                {
                    throw new UserFriendlyException($"交接单[{billId}]状态为[{bill.BillState.GetDescription()}],不可执行接收操作!");
                }

                var billLines = bill.BillLines.Where(l => lineIds.Contains(l.Id)).ToList();
                foreach (var line in billLines)
                {
                    if (line.LineState != HandOverBillLineState.Pending)
                    {
                        continue;
                    }

                    if (line.OrderInfo.SourceName == OrderSourceNames.SAP)
                    {
                        //SAP订单交接行, 构建对应接口参数
                        if (line.IsSapSendOut() && !line.NextProcess.IsEmpty())
                        {
                            createCooperateParamList.Add(new
                            {
                                LineId = line.Id,
                                CreateErpOrdersInput = new SapCooperSendInput
                                {
                                    SapMOrderNumber        = line.OrderInfo.OrderNumber,
                                    SapMOrderProcessNumber = line.NextProcess.ProcessNumber, /*SAP送出时,执行下个道序相关接口*/
                                    Direction        = SapCooperSendInput.SapCooperSendDirection.SendOut,
                                    HandOverQuantity = line.HandOverQuantity,
                                }
                            });
                        }
                        //else if (line.IsSapSendBack())
                        //{
                        //    createCooperateParamList.Add(new
                        //    {
                        //        LineId = line.Id,
                        //        CreateErpOrdersInput = new SapCooperSendInput
                        //        {
                        //            SapMOrderNumber = line.OrderInfo.OrderNumber,
                        //            SapMOrderProcessNumber = line.CurrentProcess.ProcessNumber, /*SAP送回时,执行当前道序(以及之前所有本次外协道序)相关接口*/
                        //            Direction = SapCooperSendInput.SapCooperSendDirection.SendBack,
                        //            HandOverQuantity = line.HandOverQuantity,
                        //        }
                        //    });
                        //}
                        else
                        {
                            //直接标识为成功
                            receivedBillLineIds.Add(line.Id);
                        }
                    }
                    else
                    {
                        //非SAP订单交接行, 直接标识为成功
                        receivedBillLineIds.Add(line.Id);
                    }
                }
                uow.Complete();
            }

            //执行SAP外协接口(送出/送回)
            foreach (var param in createCooperateParamList)
            {
                try
                {
                    bool result = true;
                    SapCooperSendInput cooperInput = param.CreateErpOrdersInput;
                    if (cooperInput.Direction == SapCooperSendInput.SapCooperSendDirection.SendOut)
                    {
                        result = await _cooperateAppService.SapCooperSendOut(cooperInput);
                    }
                    //else if (cooperInput.Direction == SapCooperSendInput.SapCooperSendDirection.SendBack)
                    //{
                    //    result = await _cooperateAppService.SapCooperSendBack(cooperInput);
                    //}

                    if (result)
                    {
                        receivedBillLineIds.Add(param.LineId);
                    }
                }
                catch (Exception ex)
                {
                    //确保其中任意一个交接行执行失败时,不想影响后续交接行的继续执行
                    Logger.Error("交接单接收失败!", ex);
                }
            }

            //更新接收成功行状态
            using (var uow = this.UnitOfWorkManager.Begin())
            {
                var bill = await this._handOverBillRepository.GetAll()
                           .Include(b => b.BillLines)
                           .FirstAsync(b => b.Id == billId);

                var billLines = bill.BillLines.Where(l => receivedBillLineIds.Contains(l.Id)).ToList();
                foreach (var line in billLines)
                {
                    //外协成功,更新交接单行状态
                    line.LineState        = HandOverBillLineState.Received;
                    line.OperatorUserId   = currentUser.Id;
                    line.OperatorUserName = currentUser.Surname;
                    line.OperatorDate     = DateTime.Now;
                    await this._handOverBillLineRepository.UpdateAsync(line);
                }

                await this.CurrentUnitOfWork.SaveChangesAsync();    //提交一次UOW,刷新bill数据

                bool isAllComplete = await this.checkBillCompleted(bill);

                uow.Complete();
                return(isAllComplete);
            }
        }