Exemple #1
0
        private void btnGanerate_Click(object sender, RoutedEventArgs e)
        {
            //生成操作 :
            string queryString = string.Format("{0}-{1}-{2}", SOSysNo, ProductSysNo, viewVM.PurchaseQty);

            serviceFacade.IsVSPOItemPriceLimited(queryString, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                #region
                //TODO:创建虚库采购单的权限:
                //if (QueryProviderFactory.GetQueryProvider<IQueryVSPO>().IsLimitedSVR(entity.SOItemSysNo, entity.PurchaseQty.Value))
                //{
                //    if (!HasRight("CanAddLimited"))
                //    {
                //        return Json(new
                //        {
                //            Right = Resources.GlobalResources.Warning_VSPO_NotToAdd
                //        });
                //    }
                //}
                //else
                //{
                //    if (!HasRight("CanAdd"))
                //    {
                //        return Json(new
                //        {
                //            Right = Resources.GlobalResources.Warning_VSPO_NotToAdd
                //        });
                //    }
                //}
                #endregion

                VirtualStockPurchaseOrderInfo info = EntityConverter <VirtualStockPurchaseOrderInfoVM, VirtualStockPurchaseOrderInfo> .Convert(viewVM, (s, t) =>
                {
                    t.PurchaseQty      = 1;
                    t.Status           = VirtualPurchaseOrderStatus.Normal;
                    t.CreateTime       = DateTime.Now;
                    t.InStockOrderType = VirtualPurchaseInStockOrderType.PO;
                });

                serviceFacade.CreateVSPO(info, (obj2, args2) =>
                {
                    if (args2.FaultsHandle())
                    {
                        return;
                    }
                    Window.Alert("提示", "成功生成虚库商品采购单,且发邮件通知PM负责人员!", MessageType.Information, (obj3, args3) =>
                    {
                        if (args3.DialogResult == DialogResultType.Cancel)
                        {
                            this.btnGanerate.IsEnabled = false;
                        }
                    });
                });
            });
        }