diff --git a/插件库/Lskj.Model/BillModel.cs b/插件库/Lskj.Model/BillModel.cs
index 9c62f73..6851e5f 100644
--- a/插件库/Lskj.Model/BillModel.cs
+++ b/插件库/Lskj.Model/BillModel.cs
@@ -451,6 +451,14 @@ namespace Lskj.Model
/// 单据终审后可以添加明细
///
public bool BillFinalReviewAdd;
+ ///
+ /// 单据来源主表推拽到单据主表后,隐藏推拽行
+ ///
+ public bool SourceMainPushPullHide;
+
+
+
+
///
/// Initializes a new instance of the class.
///
@@ -547,4 +555,5 @@ namespace Lskj.Model
this.TreeTableDragCondition = rowItem.Table.Columns.Contains("TreeTableDragCondition") ? rowItem["TreeTableDragCondition"] + "" : "";
this.isReplaceFixed = rowItem.Table.Columns.Contains("isReplaceFixed") ? !"1".Equals(rowItem["isReplaceFixed"] + "") : true;
this.SaveRefreshAdditional = rowItem.Table.Columns.Contains("SaveRefreshAdditional") ? "1".Equals(rowItem["SaveRefreshAdditional"] + "") : false;
- this.CancelCopyAssociation
\ No newline at end of file
+ this.CancelCopyAssociation = rowItem.Table.Columns.Contains("CancelCopyAssociation") ? !"1".Equals(rowItem["CancelCopyAssociation"] + "") : true;
+ this.PrintingConditions = row
\ No newline at end of file
diff --git a/插件库/Lskj.Model/ERPInfo.cs b/插件库/Lskj.Model/ERPInfo.cs
index b7757e4..889cab4 100644
--- a/插件库/Lskj.Model/ERPInfo.cs
+++ b/插件库/Lskj.Model/ERPInfo.cs
@@ -16,6 +16,8 @@ using System.Management;
using DevExpress.XtraTab;
using System.Windows.Forms;
using System.Runtime.InteropServices;
+using System.Net.NetworkInformation;
+using System.Net.Sockets;
namespace Lskj.Model
{
@@ -273,35 +275,88 @@ namespace Lskj.Model
/// 获取本机MAC地址
///
/// 本机MAC地址
- string GetMacAddress()
+ private string GetMacAddress()
{
try
{
- string strMac = string.Empty;
- ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
- ManagementObjectCollection moc = mc.GetInstances();
- foreach (ManagementObject mo in moc)
+ string fallbackMac = string.Empty;
+
+ NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
+
+ foreach (NetworkInterface ni in interfaces)
{
- if ((bool)mo["IPEnabled"])
+ if (ni == null)
{
- strMac = mo["MacAddress"].ToString();
- string[] IPAddress = (string[])mo["IPAddress"];
- if (IPAddress.Length > 0 && IPAddress[0].Equals(LoginIPV4))
+ continue;
+ }
+
+ if (ni.OperationalStatus != OperationalStatus.Up)
+ {
+ continue;
+ }
+
+ if (ni.NetworkInterfaceType == NetworkInterfaceType.Loopback ||
+ ni.NetworkInterfaceType == NetworkInterfaceType.Tunnel)
+ {
+ continue;
+ }
+
+ PhysicalAddress physicalAddress = ni.GetPhysicalAddress();
+ if (physicalAddress == null || physicalAddress.GetAddressBytes().Length == 0)
+ {
+ continue;
+ }
+
+ string mac = FormatMacAddress(physicalAddress);
+ if (string.IsNullOrEmpty(fallbackMac))
+ {
+ fallbackMac = mac;
+ }
+
+ IPInterfaceProperties properties = ni.GetIPProperties();
+ foreach (UnicastIPAddressInformation ipInfo in properties.UnicastAddresses)
+ {
+ if (ipInfo.Address.AddressFamily != AddressFamily.InterNetwork)
{
- break;
+ continue;
+ }
+
+ if (!string.IsNullOrEmpty(LoginIPV4) &&
+ ipInfo.Address.ToString() == LoginIPV4)
+ {
+ RecordMAC = mac;
+ return mac;
}
}
}
- moc = null;
- mc = null;
- RecordMAC= strMac.Replace(":", "-");
- return strMac.Replace(":", "-");
+
+ RecordMAC = fallbackMac;
+ return fallbackMac;
}
catch
{
return "";
}
}
+
+ private string FormatMacAddress(PhysicalAddress physicalAddress)
+ {
+ byte[] bytes = physicalAddress.GetAddressBytes();
+ StringBuilder sb = new StringBuilder();
+
+ for (int i = 0; i < bytes.Length; i++)
+ {
+ if (i > 0)
+ {
+ sb.Append("-");
+ }
+
+ sb.Append(bytes[i].ToString("X2"));
+ }
+
+ return sb.ToString();
+ }
+
///
/// 加密狗id
///