/// <summary>
        /// 自动入库
        /// </summary>
        public static bool AutoInbound(AllocateOrder allocateOrder)
        {
            bool success = true;

            if (!LockAutoInbound)
            {
                LockAutoInbound = true;
                //if (CommonGlobalCache.IsCheckStoreState)
                //{
                //    GlobalMessageBox.Show("当前库存处于盘点状态,不能进行此操作!");
                //    return false;
                //}
                //AllocateOrderPagePara pagePara = new AllocateOrderPagePara()
                //{ AllocateOrderID = allocateOrderID,
                //    AllocateOrderState = AllocateOrderState.Delivery,
                //    IsOpenDate = false,
                //  //  DestShopID = CommonGlobalCache.CurrentShopID,
                //    PageIndex = 0,
                //    PageSize = int.MaxValue
                //};
                //AllocateOrderPage listPage = CommonGlobalCache.ServerProxy.GetAllocateInboundOrderPage(pagePara);
                //if (listPage != null)
                //{
                //    foreach (var item in listPage.AllocateOrderList)
                //    {
                Outbound      outbound    = CommonGlobalCache.ServerProxy.GetOneOutbound(allocateOrder.ID);
                InboundPara   inboundPara = BuildInboundPara(outbound, allocateOrder);
                InboundResult result      = CommonGlobalCache.ServerProxy.Inbound(inboundPara);

                switch (result)
                {
                case InboundResult.Success:
                    break;

                case InboundResult.StateIsNotDelivery:
                    success = false;
                    break;

                case InboundResult.Error:
                    success = false;
                    break;

                default:
                    break;
                }
                if (!success)
                {
                    GlobalMessageBox.Show("自动入库错误!" + inboundPara.InboundOrder.ID);
                    // break;
                }

                //    }
                LockAutoInbound = false;
                //  }
            }
            return(success);
        }
        //点击入库按钮
        private void BaseButton_Inbound_Click(object sender, EventArgs e)
        {
            try
            {
                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                /*   if (this.guideComboBox1.SelectedIndex == 0 && IsPos)
                 * {
                 *     GlobalMessageBox.Show("操作人不能为空");
                 *     return;
                 * }
                 */
                /*  foreach (BoundDetail detail in this.curOutbound.OutboundDetails)
                 * {
                 *  // detail.IsConfirmed = true;
                 *  if (!detail.IsConfirmed)
                 *   {
                 *       DialogResult dialogResult= GlobalMessageBox.Show("您有商品未确认完全,是否确认收货?", "提示", MessageBoxButtons.OKCancel);
                 *       if (dialogResult != DialogResult.OK)
                 *       {
                 *           return;
                 *       }
                 *       break;
                 *   }
                 *
                 * }*/
                InboundPara inboundPara = this.BuildInboundPara();
                if (inboundPara == null || inboundPara.InboundOrder.TotalCount == 0)
                {
                    GlobalMessageBox.Show("入库单为空,不能入库!");
                    return;
                }

                InboundResult result = CommonGlobalCache.ServerProxy.Inbound(inboundPara);

                if (result == InboundResult.Error)
                {
                    GlobalMessageBox.Show("内部错误!");
                    return;
                }
                else if (result == InboundResult.StateIsNotDelivery)
                {
                    GlobalMessageBox.Show("款号已存在!");
                    return;
                }
                GlobalMessageBox.Show("收货成功!");

                // pos端确认后结束,在调拨入库时候
                this.BaseButton_Save.Visible = false;
                this.guideComboBox1.Visible  = false;
                this.skinLabel2.Visible      = false;

                //pos使用
                this.SaveSuccess();
            }
            catch (Exception ee)
            {
                ShowError(ee);
            }
            finally
            {
                UnLockPage();
            }
        }