Commit d92a4a4a LN

增加库位更新功能,10位的库位更改为12位。

1 个父辈 28eaeafd
......@@ -8,7 +8,7 @@ using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
{
......@@ -96,7 +96,7 @@ namespace OnlineStore.ACSingleStore
{
log4net.GlobalContext.Properties["fname"] = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
log4net.Config.XmlConfigurator.Configure();
System.Net.ServicePointManager.DefaultConnectionLimit = 512;
System.Net.ServicePointManager.DefaultConnectionLimit = 512;
// XmlConfigurator.Configure();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
......@@ -104,46 +104,46 @@ namespace OnlineStore.ACSingleStore
}
return;
if (!isShow)
{
//获得当前登录的Windows用户标示
System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();
System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity);
//判断当前登录用户是否为管理员
if (principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator))
{
//如果是管理员,则直接运行
log4net.GlobalContext.Properties["fname"] = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
log4net.Config.XmlConfigurator.Configure();
System.Net.ServicePointManager.DefaultConnectionLimit = 512;
// XmlConfigurator.Configure();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmStore());
}
else
{
//创建启动对象
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.WorkingDirectory = Environment.CurrentDirectory;
startInfo.FileName = Application.ExecutablePath;
//设置启动动作,确保以管理员身份运行
startInfo.Verb = "runas";
try
{
System.Diagnostics.Process.Start(startInfo);
}
catch
{
return;
}
//退出
Application.Exit();
}
}
//if (!isShow)
//{
// //获得当前登录的Windows用户标示
// System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();
// System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity);
// //判断当前登录用户是否为管理员
// if (principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator))
// {
// //如果是管理员,则直接运行
// //log4net.GlobalContext.Properties["fname"] = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
// //log4net.Config.XmlConfigurator.Configure();
// System.Net.ServicePointManager.DefaultConnectionLimit = 512;
// // XmlConfigurator.Configure();
// Application.EnableVisualStyles();
// Application.SetCompatibleTextRenderingDefault(false);
// Application.Run(new FrmStore());
// }
// else
// {
// //创建启动对象
// System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
// startInfo.UseShellExecute = true;
// startInfo.WorkingDirectory = Environment.CurrentDirectory;
// startInfo.FileName = Application.ExecutablePath;
// //设置启动动作,确保以管理员身份运行
// startInfo.Verb = "runas";
// try
// {
// System.Diagnostics.Process.Start(startInfo);
// }
// catch
// {
// return;
// }
// //退出
// Application.Exit();
// }
//}
}
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUnhandledException(e.ExceptionObject);
......
......@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
......@@ -31,7 +32,7 @@ namespace HuichuanLibrary
{
if (deviceConfigPath.Equals(""))
{
DeviceConfigPath = ".\\device_config.xml";
DeviceConfigPath =Application.StartupPath+ "\\device_config.xml";
}
else
{
......@@ -39,7 +40,7 @@ namespace HuichuanLibrary
}
if (systemConfigPath.Equals(""))
{
SystemConfigPath = ".\\system_config.xml";
SystemConfigPath = Application.StartupPath + "\\system_config.xml";
}
else
{
......@@ -67,18 +68,31 @@ namespace HuichuanLibrary
{
return true;
}
if (!File.Exists(DeviceConfigPath))
for (int i = 1; i <= 3; i++)
{
HCLogUtil.error("InitCard FAIL, 【" + DeviceConfigPath + "】not exists");
return false;
}
if (!File.Exists(SystemConfigPath))
{
HCLogUtil.error("InitCard FAIL, 【" + SystemConfigPath + "】not exists");
return false;
}
if (!File.Exists(DeviceConfigPath))
{
HCLogUtil.error("InitCard FAIL " + i + ", 【" + DeviceConfigPath + "】not exists");
if (i >= 3)
{
return false;
}
}
else if (!File.Exists(SystemConfigPath))
{
HCLogUtil.error("InitCard FAIL " + i + ", 【" + SystemConfigPath + "】not exists");
if (i >= 3)
{
return false;
}
}
else
{
break;
}
Thread.Sleep(500);
}
//【1】获取卡
Int32 nCardNum = 0;
......
......@@ -159,30 +159,7 @@ namespace OnlineStore.LoadCSVLibrary
return titleIndex;
}
protected static void BackConfig(string filePath, string[] lines)
{
////备份保存
//try
//{
// FileInfo file = new FileInfo(filePath);
// string date = DateTime.Now.ToString("yyyy-MM-dd");
// string targetBackPath = @"C:\configBack\" + date + @"\";
// if (!Directory.Exists(targetBackPath))
// {
// Directory.CreateDirectory(targetBackPath);
// }
// string fileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + "." + file.Name;
// string backFile = targetBackPath + fileName;
// if (File.Exists(backFile))
// {
// File.Delete(backFile);
// }
// File.WriteAllLines(backFile, lines, Encoding.UTF8);
//}
//catch (Exception e)
//{
// LogUtil.error("备份【" + filePath + "】到C:configBack出错:" + e.ToString());
//}
{
//备份保存
try
{
......
......@@ -249,34 +249,29 @@ namespace OnlineStore.LoadCSVLibrary
//第1和第2位表示楼层(4D)
//第3和第4位表示料仓(01) 01 - 18为流水线料仓, 19 - 24为包装料仓
//第5和第6位表示列(02)
//第7和第8位表示行(03)
//第9和第10位表示隔板位置(04)
//例如: 4D12010124 表示4楼12号料仓第1列第1行架子上的第24个隔板位置
//4D19050208 表示4楼19号料仓(包装料仓)第5列第2行架子上的第8个隔板位置
//第7和第8位表示行(AA=01,BB=02,CC=03,DD=04)
//第10,11,12,13位表示隔板位置()
//例如: 4D1201AA0024 表示4楼12号料仓第1列第1行架子上的第24个隔板位置
//3D0101AA0001
//3D01020304
string oldPosId = position.PositionNum;//08#AC1_18_3_18
string oldPosId = position.PositionNum;//3D01020304
string newPosId = "";
int jIndex = oldPosId.IndexOf("#");
int strLength = oldPosId.Length;
string louceng = "3D";
string storeId = storeIndex.ToString().PadLeft(2, '0');
if (jIndex > 0)
if (strLength.Equals(10))
{
string[] hengStr = oldPosId.Split('_');
int lie = 0;
int hang = 0;
int p = 0;
if (hengStr.Length == 4)
{
lie = Convert.ToInt32(hengStr[1]);
hang = Convert.ToInt32(hengStr[2]);
p = Convert.ToInt32(hengStr[3]);
}
string lieStr = oldPosId.Substring(4, 2);
int hang = Convert.ToInt32(Convert.ToInt32(oldPosId.Substring(6, 2)));
string pStr = oldPosId.Substring(8, 2);
string hangStr = "AA";
if (hang.Equals(1))
{
hangStr = "AA";
}else if (hang.Equals(2))
}
else if (hang.Equals(2))
{
hangStr = "BB";
}
......@@ -296,8 +291,7 @@ namespace OnlineStore.LoadCSVLibrary
{
hangStr = "FF";
}
lie++;
newPosId = louceng + storeId + lie.ToString().PadLeft(2, '0') + hangStr + p.ToString().PadLeft(4, '0');
newPosId = louceng + storeId + lieStr + hangStr + "00" + pStr;
}
else
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!