/// <summary> /// 获取当前待确认的包装标签清单 /// </summary> /// <returns></returns> private List <ConfirmPackageLabel> GetConfirmLabels() { string strProcedureName = $"{className}.{MethodBase.GetCurrentMethod().Name}"; WriteLog.Instance.WriteBeginSplitter(strProcedureName); try { int errCode = 0; string errText = ""; List <WaitConfirmPrint> datas = new List <WaitConfirmPrint>(); AsimcoPackageClient.Instance.ufn_GetList_WaitConfirmPrint( IRAPUser.Instance.CommunityID, IRAPUser.Instance.SysLogID, ref datas, out errCode, out errText); WriteLog.Instance.Write($"({errCode}){errText}", strProcedureName); if (errCode == 0) { List <ConfirmPackageLabel> rlt = new List <ConfirmPackageLabel>(); foreach (WaitConfirmPrint data in datas) { rlt.Add(ConfirmPackageLabel.Mapper <ConfirmPackageLabel, WaitConfirmPrint>(data)); } return(rlt); } else { XtraMessageBox.Show( errText, "", MessageBoxButtons.OK, MessageBoxIcon.Error); return(new List <ConfirmPackageLabel>()); } } finally { WriteLog.Instance.WriteEndSplitter(strProcedureName); } }
public static ConfirmPackageLabel Mapper <ConfirmPackageLabe, WaitConfirmPrint>(WaitConfirmPrint s) { ConfirmPackageLabel d = Activator.CreateInstance <ConfirmPackageLabel>(); Type types = s.GetType(); Type typed = typeof(ConfirmPackageLabel); foreach (PropertyInfo spi in types.GetProperties()) { foreach (PropertyInfo dpi in typed.GetProperties()) { if (dpi.Name == spi.Name) { dpi.SetValue(d, spi.GetValue(s, null), null); break; } } } return(d); }