Commit 7576c1ca LN

中英文功能修改

1 个父辈 1dc44f77
......@@ -183,9 +183,6 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="resource\ResourceMap.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
......
......@@ -22,6 +22,7 @@ namespace OnlineStore.ACSingleStore
private void FrmLanguare_Load(object sender, EventArgs e)
{
LanguageProcess();
LanguagePro();
if (ResourceCulture.CurrLanguage.Equals(ResourceCulture.English))
{
rbtnEnglish.Checked = true;
......
......@@ -219,7 +219,14 @@ namespace OnlineStore.ACSingleStore
}
}
}
lblWarnMsg.Text = store.WarnObj.WarnMsg;
if (CurrLanguage.Equals(ResourceCulture.China))
{
lblWarnMsg.Text = store.WarnObj.WarnMsg;
}
else
{
lblWarnMsg.Text = store.WarnObj.WarnMsgEn;
}
if (store.Config.IsHasDoorLimit.Equals(1))
{
......@@ -715,14 +722,14 @@ namespace OnlineStore.ACSingleStore
{
if (LogUtil.debug_opened == false)
{
开启DEBUGToolStripMenuItem.Text = "关闭DEBUG";
btnLogDebug.Text = "关闭DEBUG";
开启DEBUGToolStripMenuItem.Text = ResourceCulture.GetString("关闭DEBUG");
btnLogDebug.Text =ResourceCulture.GetString( "关闭DEBUG");
LogUtil.debug_opened = true;
}
else
{
开启DEBUGToolStripMenuItem.Text = "开启DEBUG";
btnLogDebug.Text = "开启DEBUG";
开启DEBUGToolStripMenuItem.Text = ResourceCulture.GetString("开启DEBUG");
btnLogDebug.Text = ResourceCulture.GetString("开启DEBUG");
LogUtil.debug_opened = false;
}
}
......@@ -1105,6 +1112,7 @@ namespace OnlineStore.ACSingleStore
frm.ShowDialog();
this.LanguageProcess();
LanguagePro();
}
......
......@@ -45,6 +45,8 @@ namespace OnlineStore
private static char spilt = ',';
private static void LoadData()
{
ResourceControl.GetChinaStringEvent += GetChinaString;
ResourceControl.GetEnglishStringEvent += GetEnglishString;
ResourceControl.GetStringEvent += GetString;
CSVResourceControl.GetStrEvent += GetString;
CSVResourceControl.GetStringEvent += GetString;
......@@ -238,7 +240,52 @@ namespace OnlineStore
return map;
}
public static string GetChinaString(string id, params object[] param)
{
string strCurLanguage = gets(China, id);
return String.Format(strCurLanguage, param);
}
public static string GetEnglishString(string id, params object[] param)
{
string strCurLanguage = gets(English, id);
return String.Format(strCurLanguage, param);
}
private static string gets(string language,string id,string defaultStr="")
{
if (String.IsNullOrEmpty(defaultStr))
{
defaultStr = id;
}
try
{
if (ResourceMap != null)
{
if (!ResourceMap.ContainsKey(CurrLanguage))
{
if (ShowMsg)
{
LogUtil.error("No Language Resources:[" + id + "], please add");
}
return defaultStr;
}
else
{
if (ResourceMap[CurrLanguage].ContainsKey(id.Trim()))
{
return ResourceMap[CurrLanguage][id];
}
else
{
NoIdLog(id, defaultStr);
}
}
}
}
catch (Exception ex)
{
NoIdLog(id, defaultStr);
}return defaultStr;
}
public static string GetString(string id, string defaultStr="")
{
string strCurLanguage = defaultStr;
......
......@@ -289,4 +289,10 @@ trayHeight,料盘高度,Reel height,
确定开始自动出入库?,确定开始自动出入库?,Make sure to start automatic storage ?,
请输入正确的密码,请输入正确的密码,Enter the right PSW,
打开串口失败,打开串口失败,Failed to open serial port,
请输入正确的速度,请输入正确的速度,Please enter the correct speed,
请输入正确的速度,请输入正确的速度,Please enter the correct speed,
自动出库:,自动出库:,Auto outbound:
自动入库:,自动入库:,Auto warehousing:
升降轴位置调试:,升降轴位置调试:,Updown-Axis Debug Location
关闭DEBUG,关闭DEBUG, Close DEBUG
开启DEBUG,开启DEBUG, Open DEBUG
出库{0}叉子从库位退出后,未检测到料盘有料,出库{0}叉子从库位退出后,未检测到料盘有料,Outgoing {0} after the fork exits from the storage, no material on the tray is detected
\ No newline at end of file
......@@ -289,4 +289,10 @@ trayHeight,料盘高度,Reel height,
确定开始自动出入库?,确定开始自动出入库?,Make sure to start automatic storage ?,
请输入正确的密码,请输入正确的密码,Enter the right PSW,
打开串口失败,打开串口失败,Failed to open serial port,
请输入正确的速度,请输入正确的速度,Please enter the correct speed,
请输入正确的速度,请输入正确的速度,Please enter the correct speed,
自动出库:,自动出库:,Auto outbound:
自动入库:,自动入库:,Auto warehousing:
升降轴位置调试:,升降轴位置调试:,Updown-Axis Debug Location
关闭DEBUG,关闭DEBUG, Close DEBUG
开启DEBUG,开启DEBUG, Open DEBUG
出库{0}叉子从库位退出后,未检测到料盘有料,出库{0}叉子从库位退出后,未检测到料盘有料,Outgoing {0} after the fork exits from the storage,no material on the tray is detected
\ No newline at end of file
......@@ -93,4 +93,6 @@ DeCodeType=解码类型,0=halcon,1=zxing解码 西安料仓解析方式。2=
主要修改内容:压紧轴改为伺服控制。IO模块使用零点模块。
使用新IO定义。增加蜂鸣器处理
20200114 在RC1258-ACSingleStore 的基础上新建分支,扫码枪改为datalogic扫码枪。
\ No newline at end of file
20200114 在RC1258-ACSingleStore 的基础上新建分支,扫码枪改为datalogic扫码枪。
20200210中英文功能修改,与服务器通信增加msgEn,表示英文提示消息。
\ No newline at end of file
......@@ -63,6 +63,8 @@ namespace OnlineStore.Common
/// 警告:出库盘到达工位但是没有工人操作
/// </summary>
public string msg { get; set; }
public string msgEn { get; set; }
/// <summary>
/// 包含的多个 BOX 的状态信息
/// </summary>
......@@ -96,6 +98,8 @@ namespace OnlineStore.Common
/// 出库失败原因:
/// </summary>
public string msg { get; set; }
public string msgEn { get; set; }
/// <summary>
/// 温度
/// </summary>
......@@ -119,7 +123,7 @@ namespace OnlineStore.Common
public class AlarmInfo
{
public AlarmInfo(int StoreID, int aType, string alarmDetial, string WarnMsg, int inoutStatus)
public AlarmInfo(int StoreID, int aType, string alarmDetial, string WarnMsg,string alarmMsgEn, int inoutStatus)
{
// TODO: Complete member initialization
this.boxId = StoreID;
......@@ -127,6 +131,7 @@ namespace OnlineStore.Common
this.alarmDetail = alarmDetial;
this.alarmMsg = WarnMsg;
this.inOutStatus = inoutStatus;
this.alarmMsgEn = alarmMsgEn;
}
public AlarmInfo()
......@@ -156,6 +161,8 @@ namespace OnlineStore.Common
//AlarmType=3 IO报警,信号超时 io电器定义(电器定义)
/// </summary>
public string alarmDetail { get; set; }
public string alarmMsgEn { get; set; }
/// <summary>
/// 报警消息
/// </summary>
......
......@@ -15,6 +15,12 @@ namespace OnlineStore.DeviceLibrary
public delegate string GetStringDelegate(string id, string defaultStr, params object[] param);
public static event GetStringDelegate GetStringEvent;
public delegate string GetChinaStringDelegate(string id, params object[] param);
public static event GetChinaStringDelegate GetChinaStringEvent;
public delegate string GetEnglishStringDelegate(string id, params object[] param);
public static event GetEnglishStringDelegate GetEnglishStringEvent;
public static string GetMsgStr(string value)
{
string result = GetStrEvent?.Invoke(value, value);
......@@ -36,6 +42,15 @@ namespace OnlineStore.DeviceLibrary
return result;
}
public static string GetChinaString( string id, params object[] param)
{
return GetChinaStringEvent?.Invoke(id, param);
}
public static string GetEnglishString(string id, params object[] param)
{
return GetEnglishStringEvent?.Invoke(id, param);
}
/// <summary>
/// AutoOut 自动出库:
......
......@@ -127,7 +127,7 @@ namespace OnlineStore.DeviceLibrary
// WarnMsg = StoreName + "收到急停信号,报警急停";
SetWarnMsg(ResourceControl.inSuddenStop);
//报警时会关闭所有轴
Alarm(StoreAlarmType.SuddenStop, "1", WarnObj.WarnMsg, StoreMoveType.None);
Alarm(StoreAlarmType.SuddenStop, "1", StoreMoveType.None);
}
}
else
......@@ -585,7 +585,7 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg(ResourceControl.OpenAxisFail,axis.DisplayStr);
// WarnMsg = StoreName + "打开轴" + axis.Explain + "失败 ";
LogUtil.info(LOGGER, StoreName +WarnObj.WarnMsg);
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axis).ToString(), WarnObj.WarnMsg, StoreMove.MoveType);
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axis).ToString(), StoreMove.MoveType);
return false;
}
}
......@@ -651,9 +651,10 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString());
}
public override void Alarm(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType)
public override void Alarm(StoreAlarmType alarmType, string alarmDetial, StoreMoveType storeMoveType)
{
SaveAlarmInfo(alarmType, alarmDetial, alarmMsg, storeMoveType);
//string alarmMsg,string alarmMsgEn,
SaveAlarmInfo(alarmType, alarmDetial, WarnObj.WarnMsg, WarnObj.WarnMsgEn, storeMoveType);
autoNext = false;
if (this.alarmType.Equals(alarmType) && alarmType != StoreAlarmType.SuddenStop && alarmType != StoreAlarmType.NoAirCheck)
......@@ -755,7 +756,7 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg(ResourceControl.NoAIr);
preAirValue = IO_VALUE.LOW;
LogUtil.info("已持续【" + FormUtil.GetSpanStr(span) + "】未检测到气压信号,报警");
Alarm(StoreAlarmType.NoAirCheck, "2", WarnObj.WarnMsg, StoreMoveType.None);
Alarm(StoreAlarmType.NoAirCheck, "2", StoreMoveType.None);
return;
}
}
......@@ -1232,7 +1233,7 @@ namespace OnlineStore.DeviceLibrary
//WarnMsg = StoreName + " 运动轴" + axisInfo.Explain + "报警";
SetWarnMsg(ResourceControl.AxisAlarm, axisInfo.DisplayStr);
info.AlarmIoValue = alarmIo;
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axisInfo).ToString(), WarnObj.WarnMsg, StoreMoveType.None);
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axisInfo).ToString(), StoreMoveType.None);
isInAlarm = true;
}
else
......@@ -1323,7 +1324,8 @@ namespace OnlineStore.DeviceLibrary
{
IsNotScanCode = true;
IsScanCode = false;
CodeMsg = "没有收到二维码信息,请重新放入料盘";
CodeMsg =ResourceControl.GetChinaString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘");
CodeMsgEn = ResourceControl.GetEnglishString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘");
LogUtil.info(LOGGER, StoreName + "没有收到二维码信息,请重新放入料盘");
return;
}
......@@ -1720,6 +1722,7 @@ namespace OnlineStore.DeviceLibrary
#region 与服务器通信定时器,每1秒向服务器通知一次状态,同时执行出库操作
private string CodeMsg = "";
private string CodeMsgEn = "";
private bool isInProcess = false;
public void server_connect_timer_Tick(object sender, EventArgs e)
{
......@@ -1764,6 +1767,7 @@ namespace OnlineStore.DeviceLibrary
{
lineOperation.status = (int)StoreStatus.Warning;
lineOperation.msg = WarnObj.WarnMsg;
lineOperation.msgEn = WarnObj.WarnMsgEn;
}
else if (IsRun)
{
......@@ -1782,19 +1786,26 @@ namespace OnlineStore.DeviceLibrary
boxStatus.status = (int)StoreStatus.Debugging;
}
boxStatus.msg = WarnObj.WarnMsg;
boxStatus.msgEn = WarnObj.WarnMsgEn;
lineOperation.msg = WarnObj.WarnMsg;
lineOperation.msgEn = WarnObj.WarnMsgEn;
if (WarnObj.WarnMsg.Equals(""))
{
boxStatus.msg = CodeMsg;
boxStatus.msgEn = CodeMsgEn;
// lineOperation.msg = CodeMsg;
lineOperation.msg = CodeMsg;
lineOperation.msgEn = CodeMsgEn;
}
if (CodeMsg.Equals(""))
{
if (storeRunStatus.Equals(StoreRunStatus.Runing) && IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
boxStatus.msg = "叉子料盘检测有料,请检查";
lineOperation.msg = "叉子料盘检测有料,请检查";
boxStatus.msg = ResourceControl.GetChinaString("叉子料盘检测有料,请检查");
lineOperation.msg = ResourceControl.GetChinaString("叉子料盘检测有料,请检查");
boxStatus.msgEn = ResourceControl.GetEnglishString("叉子料盘检测有料,请检查");
lineOperation.msgEn = ResourceControl.GetEnglishString("叉子料盘检测有料,请检查");
}
}
CodeMsg = "";
......
......@@ -140,7 +140,7 @@ namespace OnlineStore.DeviceLibrary
{
isOk = false;
// WarnMsg = msg;
Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), msg, StoreMove.MoveType);
Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), StoreMove.MoveType);
break;
}
}
......@@ -157,7 +157,7 @@ namespace OnlineStore.DeviceLibrary
ConfigIO io = Config.getWaitIO(wait.IoType);
//WarnMsg = StoreName + " 等待信号" + io.DisplayStr + "=" + wait.IoValue + "超时!";
SetWarnMsg(ResourceControl.WaitSingleTimeOut, io.DisplayStr, wait.IoValue.ToString());
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnObj.WarnMsg, StoreMove.MoveType);
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, StoreMove.MoveType);
LogUtil.error(LOGGER, StoreName + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14);
isOk = false;
break;
......@@ -209,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
// + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
SetWarnMsg(ResourceControl.MoveTimeOut, StoreMove.MoveStep + "", NotOkMsg, Math.Round(span.TotalSeconds, 1)+"");
LogUtil.error(LOGGER, WarnObj.WarnMsg,100);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnObj.WarnMsg, StoreMove.MoveType);
Alarm(StoreAlarmType.IoSingleTimeOut, "", StoreMove.MoveType);
}
}
private static DateTime lastComRHomeTime = DateTime.Now;
......@@ -597,6 +597,7 @@ namespace OnlineStore.DeviceLibrary
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
CodeMsg = "出库[" + posId + "]叉子从库位退出后,未检测到料盘有料";
CodeMsgEn = ResourceControl.GetEnglishString("出库{0}叉子从库位退出后,未检测到料盘有料", posId);
LogUtil.error(CodeMsg);
}
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
......
......@@ -186,13 +186,15 @@ namespace OnlineStore.DeviceLibrary
{
// WarnMsg =msg;
WarnObj.WarnMsg = "";
WarnObj.WarnMsgEn = "";
WarnObj.MsgCode = "";
WarnObj.MsgParam = param;
}
else
{
// WarnMsg = String.Format(msg, param);
WarnObj.WarnMsg = ResourceControl.GetString(code, param);
WarnObj.WarnMsg = ResourceControl.GetChinaString(code, param);
WarnObj.WarnMsgEn = ResourceControl.GetEnglishString(code, param);
WarnObj.MsgCode = code;
WarnObj.MsgParam = param;
}
......@@ -202,19 +204,20 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg(code, param);
LogUtil.error("WarnObj: Type[" + WarnObj.MsgCode + "]Msg[" + WarnObj.WarnMsg + "]");
}
public void SetWaitWarnMsg(string myType, string type, params string[] param)
{
WarnObj.WarnMsg = myType;
WarnObj.MsgCode = type;
WarnObj.MsgParam = param;
}
//public void SetWaitWarnMsg(string myType, string type, params string[] param)
//{
// WarnObj.WarnMsg = myType;
// WarnObj.MsgCode = type;
// WarnObj.WarnMsgEn=
// WarnObj.MsgParam = param;
//}
}
public class WarnInfo
{
public WarnInfo()
{
WarnMsgEn = "";
MsgCode = "";
WarnMsg = "";
MsgParam = null;
......@@ -222,7 +225,7 @@ namespace OnlineStore.DeviceLibrary
public string MsgCode { set; get; }
public string WarnMsg { set; get; }
public string WarnMsgEn {set;get;}
public string[] MsgParam { set; get; }
}
}
......@@ -146,7 +146,7 @@ namespace OnlineStore.DeviceLibrary
}
isInPro = false;
}
protected void SaveAlarmInfo(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType)
protected void SaveAlarmInfo(StoreAlarmType alarmType, string alarmDetial, string alarmMsg,string alarmMsgEn, StoreMoveType storeMoveType)
{
alarmMsg = alarmMsg.Replace(StoreName, "");
int inoutStatus = 0;
......@@ -184,7 +184,7 @@ namespace OnlineStore.DeviceLibrary
break;
default: break;
}
alarmInfo = new AlarmInfo(StoreID, aType, alarmDetial, alarmMsg, inoutStatus);
alarmInfo = new AlarmInfo(StoreID, aType, alarmDetial, alarmMsg,alarmMsgEn, inoutStatus);
}
/// <summary>
......@@ -199,7 +199,7 @@ namespace OnlineStore.DeviceLibrary
/// 报警
/// </summary>
/// <param name="alarmType"></param>
public abstract void Alarm(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType);
public abstract void Alarm(StoreAlarmType alarmType, string alarmDetial, StoreMoveType storeMoveType);
/// <summary>
/// 重置(夹料装置状态不变)
/// </summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!