//校验物料批次是否重复领用 重复领用弹出提示确认
var pickDetailsGrid = ServiceDetails.Data as N_MatPickDetails[];
List<N_MatPickDetails> pickList = new List<N_MatPickDetails>();
if (pickDetailsGrid != null)
{
pickList = pickDetailsGrid.ToList();
var findIsHave = pickList.Find(p => p.MaterialLot.Name != null && p.MaterialLot.Name == Convert.ToString(MaterialLot.Data));
if (findIsHave != null)
{
CommFunc.PopupPage_BackResult(wpSelectionWP, new string[] { "UIComponentDataResult" }, new string[] { "UIComponentDataResult" }, new string[0], new string[0], 400, 200, "N_PickMatCheckVP");
return;
}
}
public static void PopupPage_BackResult(Camstar.WebPortal.WebPortlets.MatrixWebPart RefPage, string[] SourceDMs_BK, string[] DestDMs_BK, string[] SourceDMs, string[] DestDMs, int width, int height, string PageName = "utac_SS_ITRDetailPopup_VP")
{
Camstar.WebPortal.Personalization.FloatPageOpenAction objAction = new FloatPageOpenAction();
objAction.PageName = PageName;
if (SourceDMs.Length > 0)//传入参数
{
UIComponentDataContractLink[] objLinks = new UIComponentDataContractLink[SourceDMs.Length];
for (int i = 0; i < objLinks.Length; i++)
{
objLinks[i] = new UIComponentDataContractLink();
objLinks[i].SourceMember = SourceDMs[i];
objLinks[i].TargetMember = DestDMs[i];
}
objAction.DataContractMap = new UIComponentDataContractMap();
objAction.DataContractMap.Links = objLinks;
}
if (DestDMs_BK.Length>0)//传回参数
{
UIComponentDataContractReturnLink[] objReturnLinks = new UIComponentDataContractReturnLink[DestDMs_BK.Length];
for (int i = 0; i < objReturnLinks.Length; i++)
{
objReturnLinks[i] = new UIComponentDataContractReturnLink();
objReturnLinks[i].SourceMember = DestDMs_BK[i];
objReturnLinks[i].TargetMember = SourceDMs_BK[i];
}
objAction.DataContractReturnMap = new UIComponentDataContractReturnMap();
objAction.DataContractReturnMap.ReturnLinks = objReturnLinks;
}
objAction.FrameLocation = new UIFloatingPageLocation();
objAction.FrameLocation.Width = width;
objAction.FrameLocation.HeightSpecified = true;
objAction.FrameLocation.Height = height;
objAction.FrameLocation.WidthSpecified = true;
objAction.EndResponse = false;
objAction.CssClass = "N_WebPartSize";
RefPage.Page.ActionDispatcher.ExecuteAction(objAction);
}
弹窗vp绑定的CS
namespace Camstar.WebPortal.WebPortlets.Shopfloor
{
public class N_CheckIsSureSubmit : MatrixWebPart
{
protected override void OnLoad(System.EventArgs e)
{
base.OnLoad(e);
//Submit.Click += new EventHandler(BtnSubmit_Click);
//Clear.Click += new EventHandler(ClearBtn_Click);
}
protected override IEnumerable<ScriptReference> GetScriptReferences()
{
byte[] randomBytes = new byte[4];
System.Security.Cryptography.RNGCryptoServiceProvider rngServiceProvider = new System.Security.Cryptography.RNGCryptoServiceProvider();
rngServiceProvider.GetBytes(randomBytes);
int RadUnmber = BitConverter.ToInt32(randomBytes, 0);
List<ScriptReference> refs = base.GetScriptReferences().ToList<ScriptReference>();
refs.Add(new ScriptReference("~/Scripts/User/N_IFrameVP.js?r" + RadUnmber.ToString()));
return refs;
}
public override void WebPartCustomAction(object sender, CustomActionEventArgs e)
{
base.WebPartCustomAction(sender, e);
var action = e.Action as Personalization.CustomAction;
if (action != null)
{
switch (action.Parameters)
{
case "Close":
{
BtnClose_Click();
break;
}
case "Submit":
{
BtnSubmit_Click();
break;
}
}
}
}
protected virtual void BtnSubmit_Click()
{
try
{
Page.DataContract.SetValueByName("UIComponentDataResult", "1");
Page.CloseFloatingFrameOnSubmit(new ResultStatus());
}
catch (Exception ex)
{
Page.DisplayMessage(ex.Message, false);
}
}
protected virtual void BtnClose_Click()
{
try
{
Page.DataContract.SetValueByName("UIComponentDataResult", "0");
Page.CloseFloatingFrameOnSubmit(new ResultStatus());
}
catch (Exception ex)
{
Page.DisplayMessage(ex.Message, false);
}
}
}
}
根据弹窗返回的结果做相应处理
if (Page.EventArgument == "FloatingFrameSubmitParentPostBackArgument")
{
var gridRowID = Page.PortalContext.DataContract.GetValueByName<string>("_Grid_ColID");
var SubProduct = Page.PortalContext.DataContract.GetValueByName<string>("Back_Product");
var SubProductDesc = Page.PortalContext.DataContract.GetValueByName<string>("Back_ProductDesc");
if (!string.IsNullOrEmpty(gridRowID))
{
(BomDetails.GridContext as BoundContext).SetCell(gridRowID, "SubProduct", SubProduct);
(BomDetails.GridContext as BoundContext).SetCell(gridRowID, "SubProductDesc", SubProductDesc);
}
var uiComponentDataResult = Page.PortalContext.DataContract.GetValueByName<string>("UIComponentDataResult");
if (!string.IsNullOrEmpty(uiComponentDataResult) && uiComponentDataResult == "1")
{
MaterialLot_DataChangedAction();
}
else if (!string.IsNullOrEmpty(uiComponentDataResult) && uiComponentDataResult == "0")
{
MaterialLot.Data = "";
MaterialLot.Focus();
}
}