Commit d92a4a4a LN

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

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