/// <summary> /// 生成采购单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCreatePO_Click(object sender, RoutedEventArgs e) { GiftCardFabricationMaster item = new GiftCardFabricationMaster(); List <GiftCardFabrication> list = new List <GiftCardFabrication>(); item = VM.ConvertVM <GiftCardFabricationVM, GiftCardFabricationMaster>(); item.CompanyCode = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode; foreach (GiftCardFabricationItemVM gift in gridVM) { if (gift.Quantity.HasValue && gift.Quantity.Value > 0) { GiftCardFabrication g = new GiftCardFabrication(); g.Product = new ProductInfo(); g.Product.ProductID = gift.ProductID; g.Quantity = gift.Quantity; g.Product.SysNo = gift.ProductSysNo.Value; g.MasterSysNo = VM.SysNo.Value; g.PMUserSysNo = gift.PMUserSysNo; list.Add(g); } } if (list.Count > 0) { item.GiftCardFabricationList = list; facade.CreatePOGiftCardFabrication(item, (obj, args) => { if (args.FaultsHandle()) { return; } if (args.Result != 0) { VM.POSysNo = args.Result.ToString(); hlPOSysNo.Content = VM.POSysNo; CPApplication.Current.CurrentPage.Context.Window.Alert(ResGiftCardInfo.Information_OperateSuccessful, MessageType.Information); if (Dialog != null) { Dialog.ResultArgs.Data = null; Dialog.ResultArgs.DialogResult = DialogResultType.OK; Dialog.Close(); } } }); } else { CPApplication.Current.CurrentPage.Context.Window.Alert(ResGiftCardInfo.Information_NeedGiftQuantity, MessageType.Warning); } }