Commit 00f6e9ef 刘韬

1

1 个父辈 65126bb1
using log4net; using log4net;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.Layout; using System.Windows.Forms.Layout;
...@@ -17,16 +19,8 @@ namespace OnlineStore ...@@ -17,16 +19,8 @@ namespace OnlineStore
public class CodeResourceControl public class CodeResourceControl
{ {
public static readonly ILog LOG = LogManager.GetLogger("LngResource"); public static readonly ILog LOG = LogManager.GetLogger("LngResource");
//public delegate string GetStrDelegate(string id, string defaultStr);
//public static event GetStrDelegate GetStrEvent;
//public delegate string GetStringDelegate(string id, string defaultStr, params object[] param);
//public static event GetStringDelegate GetStringEvent;
public static bool OpenResourceLog = false; public static bool OpenResourceLog = false;
public static string China = "zh-CN"; public static string China = "zh-CN";
public static string English = "en-US";
//private static Dictionary<string, string> chineseMap = new Dictionary<string, string>();
//private static Dictionary<string, string> englishMap = new Dictionary<string, string>();
private static Dictionary<string,Dictionary<string, string>> LangMap = new Dictionary<string, Dictionary<string, string>>(); private static Dictionary<string,Dictionary<string, string>> LangMap = new Dictionary<string, Dictionary<string, string>>();
...@@ -38,6 +32,111 @@ namespace OnlineStore ...@@ -38,6 +32,111 @@ namespace OnlineStore
public static event EventHandler LanguageChangeEvent; public static event EventHandler LanguageChangeEvent;
static CodeResourceControl() {
LoadData();
LoadData(true);
Task.Run(() => {
//return;
try
{
Task.Delay(10 * 1000).Wait();
var lngjson = JsonHelper.SerializeObject(LangMap);
if (SMF.UploadLangJsonData(lngjson, out SmfResult smfResult))
{
LogUtil.info("语言资源上传成功");
}
else
{
LogUtil.info("语言资源上传失败");
}
var lngdatas = SMF.DownloadLngData();
foreach (var lngdata in lngdatas)
{
var datalines = lngdata.resourceMap.ToList().Select((kv) => { return kv.Key + "\t\t" + kv.Value; }).ToArray();
string lngfilename = "server\\" + lngdata.lanCode + ".lngres";
Directory.CreateDirectory(Path.Combine(rPath, "server"));
File.WriteAllLines(Path.Combine(rPath, lngfilename), datalines);
}
LoadData(true);
//SetCurrentCulture(CurrLanguage);
LanguageChangeEvent?.Invoke(null, EventArgs.Empty);
}
catch (Exception e)
{
LogUtil.info("语言资源处理出错:" + e.ToString());
}
});
}
private static char spilt = '\t';
private static string rPath = Application.StartupPath + @"\resources\";
private static void LoadData(bool loadserverdir = false)
{
string loadpath = rPath;
if (loadserverdir)
loadpath = Path.Combine(rPath, "server");
Directory.CreateDirectory(loadpath);
string[] lngresfiles = Directory.GetFiles(loadpath, "*.lngres");
foreach (var lngresfile in lngresfiles)
{
Dictionary<string, string> lngMap;
var lngname = Path.GetFileNameWithoutExtension(lngresfile);
if (!LangMap.ContainsKey(lngname))
{
LangMap.Add(lngname, new Dictionary<string, string>());
}
lngMap = LangMap[lngname];
string[] lines = File.ReadAllLines(lngresfile);
foreach (string line in lines)
{
if (string.IsNullOrEmpty(line))
continue;
string[] array = line.Split(spilt);
if (array.Length >= 3)
{
string key = array[0].Trim();
string value = array[2];
if (lngMap.ContainsKey(key))
lngMap[key] = value;
else
lngMap.Add(key, value);
}
}
}
}
static Dictionary<string, string> LangName = new Dictionary<string, string>() {
{"zh-CN","简体中文" },
{"zh-TW","繁體中文" },
{ "en-US", "English" },
{ "ja-JP", "日本語" },
{ "fr-FR", "Français" },
{ "de-DE", "Deutsche" },
};
public static Dictionary<string, string> GetLangList()
{
Dictionary<string, string> LangList = new Dictionary<string, string>();
foreach (var v in LangName)
{
if (LangMap.ContainsKey(v.Key))
{
if (!LangList.ContainsKey(v.Key))
LangList.Add(v.Key, v.Value);
}
}
return LangList;
}
public static void LanguageChange() { public static void LanguageChange() {
LanguageChangeEvent?.Invoke(null, EventArgs.Empty); LanguageChangeEvent?.Invoke(null, EventArgs.Empty);
} }
...@@ -61,10 +160,6 @@ namespace OnlineStore ...@@ -61,10 +160,6 @@ namespace OnlineStore
{ {
return className + spiltStr + controlName + spiltStr + Text; return className + spiltStr + controlName + spiltStr + Text;
} }
public static string GetTextIdStr(string className)
{
return className + spiltStr + Text;
}
public static string GetString(object id, string defaultStr) public static string GetString(object id, string defaultStr)
{ {
return GetString(id.ToString(), defaultStr); return GetString(id.ToString(), defaultStr);
...@@ -132,12 +227,12 @@ namespace OnlineStore ...@@ -132,12 +227,12 @@ namespace OnlineStore
select a; select a;
return x.Count() == 0; return x.Count() == 0;
} }
static CodeResourceControl()
{
}
private static bool getLangRes(string lang) { private static bool getLangRes(string lang) {
if (!LangMap.ContainsKey(lang)) { if (!LangMap.ContainsKey(lang)) {
string path = Application.StartupPath + @"\resources\"+lang+".txt"; string path = Application.StartupPath + @"\resources\"+lang+ ".lngres";
if (!File.Exists(path)) if (!File.Exists(path))
{ {
return false; return false;
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath> <HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
...@@ -70,6 +73,7 @@ ...@@ -70,6 +73,7 @@
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="util\CTcpClient.cs" /> <Compile Include="util\CTcpClient.cs" />
<Compile Include="util\SMF.cs" />
<Compile Include="util\TcpServer.cs" /> <Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" /> <Compile Include="util\UdpServer.cs" />
</ItemGroup> </ItemGroup>
......
...@@ -125,6 +125,7 @@ namespace OnlineStore.Common ...@@ -125,6 +125,7 @@ namespace OnlineStore.Common
monitor_open_fail, monitor_open_fail,
monitor_config_load_fail, monitor_config_load_fail,
monitor_config_not_exist, monitor_config_not_exist,
AxisMoveControl_status_monitor AxisMoveControl_status_monitor,
string_full_takeout
} }
} }
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.Common
{
public class SMF
{
public static string DeviceType = "MIMO_PLUS";
static string _server = ConfigHelper.Config.Get("http_server");
static string server
{
get
{
//_server = "http://192.168.1.243/smf-core";
if (_server.EndsWith("/"))
{
return _server.Remove(_server.Length - 1, 1);
}
else
return _server;
}
}
public static bool UploadLangJsonData(string json, out SmfResult smfResult)
{
var insertindex = json.IndexOf("{");
json = json.Insert(insertindex + 1, "\"type\": \"" + DeviceType + "\",");
return UploadJsonData("/api/translation/resource", json, out smfResult);
}
public static bool UploadJsonData(string api, string json, out SmfResult smfResult)
{
smfResult = new SmfResult();
if (string.IsNullOrEmpty(server))
return false;
try
{
MyWebClient wc = new MyWebClient(10 * 1000);
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
var resp = wc.UploadData(server + api, Encoding.UTF8.GetBytes(json));
smfResult = JsonHelper.DeserializeJsonToObject<SmfResult>(Encoding.UTF8.GetString(resp));
}
catch (Exception e)
{
LogUtil.info($"UploadJsonData:{api}" + e.ToString());
}
return smfResult.okResult;
}
public static List<SmfLangData> DownloadLngData()
{
string api = "/api/translation/resource?type=" + DeviceType;
try
{
MyWebClient wc = new MyWebClient(10 * 1000);
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
var resp = wc.DownloadData(server + api);
var jsondata = Encoding.UTF8.GetString(resp);
return JsonConvert.DeserializeObject<List<SmfLangData>>(jsondata);
}
catch (Exception e)
{
LogUtil.info($"DownloadLngData:{api}" + e.ToString());
}
return new List<SmfLangData>();
}
}
//{"code":0,"data":"ok","msg":"ok","msgKey":"smfcore.ok","okResult":true}
public class SmfResult
{
public int code;
public string data;
public string msg;
public string msgKey;
public bool okResult;
}
public class SmfLangData
{
public string lanCode;
public Dictionary<string, string> resourceMap;
}
}
...@@ -196,6 +196,8 @@ namespace DeviceLibrary ...@@ -196,6 +196,8 @@ namespace DeviceLibrary
var cameraName = cameraNameList[ii]; var cameraName = cameraNameList[ii];
cameraTask[ii] = Task.Run(new Action(() => cameraTask[ii] = Task.Run(new Action(() =>
{ {
int retrytime = 0;
retry:
LogUtil.info($"【" + cameraName + "】开始取图片"); LogUtil.info($"【" + cameraName + "】开始取图片");
if (cameraName.Trim().Equals("")) if (cameraName.Trim().Equals(""))
{ {
...@@ -208,6 +210,15 @@ namespace DeviceLibrary ...@@ -208,6 +210,15 @@ namespace DeviceLibrary
{ {
bool nohalcon = true; bool nohalcon = true;
ho_Image = Camera._cam.CaptureOnImage(cameraName, out bmp, nohalcon); ho_Image = Camera._cam.CaptureOnImage(cameraName, out bmp, nohalcon);
if (bmp == null)
{
if (retrytime > 2)
return;
retrytime++;
LogUtil.info($"bitmap为空重试第{retrytime}次");
Task.Delay(1500).Wait();
goto retry;
}
//HalconDotNet.HOperatorSet.RotateImage() //HalconDotNet.HOperatorSet.RotateImage()
if (ho_Image == null && !nohalcon) if (ho_Image == null && !nohalcon)
{ {
......
...@@ -102,6 +102,7 @@ namespace DeviceLibrary ...@@ -102,6 +102,7 @@ namespace DeviceLibrary
Operation operation = getLineBoxStatus(); Operation operation = getLineBoxStatus();
if (!string.IsNullOrEmpty(posid)) if (!string.IsNullOrEmpty(posid))
operation.boxStatus[StoreID].data.Add(ParamDefine.posId, posid); operation.boxStatus[StoreID].data.Add(ParamDefine.posId, posid);
LogUtil.info($"SendStoreState,posid:{posid}, storeStatus:{storeStatus}");
operation.boxStatus[StoreID].status = (int)storeStatus; operation.boxStatus[StoreID].status = (int)storeStatus;
LogUtil.info(JsonHelper.SerializeObject(operation)); LogUtil.info(JsonHelper.SerializeObject(operation));
......
...@@ -171,6 +171,7 @@ namespace DeviceLibrary ...@@ -171,6 +171,7 @@ namespace DeviceLibrary
{ {
IgnoreX09 = false; IgnoreX09 = false;
MoveInfo.NextMoveStep(MoveStep.StoreTS10); MoveInfo.NextMoveStep(MoveStep.StoreTS10);
MoveInfo.log($"{storeMoveType}:X30取到料");
InOutEndProcess(StoreMoveType.OutStore, From.posid); InOutEndProcess(StoreMoveType.OutStore, From.posid);
} }
break; break;
......
...@@ -246,6 +246,7 @@ namespace DeviceLibrary ...@@ -246,6 +246,7 @@ namespace DeviceLibrary
Batch_Axis.AbsMove(StringMoveInfo, tpos, Config.Batch_P1_speed); Batch_Axis.AbsMove(StringMoveInfo, tpos, Config.Batch_P1_speed);
} else { } else {
StringMoveInfo.NextMoveStep(MoveStep.StringOut_01); StringMoveInfo.NextMoveStep(MoveStep.StringOut_01);
StringState = StringStateE.Full;
StringMoveInfo.log($"料串已满可以送出"); StringMoveInfo.log($"料串已满可以送出");
} }
break; break;
...@@ -278,10 +279,12 @@ namespace DeviceLibrary ...@@ -278,10 +279,12 @@ namespace DeviceLibrary
CylinderMove(StringMoveInfo, IO_Type.StringFix_Bottom, IO_Type.StringFix_Top, IO_VALUE.LOW); CylinderMove(StringMoveInfo, IO_Type.StringFix_Bottom, IO_Type.StringFix_Top, IO_VALUE.LOW);
break; break;
case MoveStep.StringOut_Released: case MoveStep.StringOut_Released:
Msg.add(crc.GetString(L.string_full_takeout, "料串已满请取出"), MsgLevel.warning);//0427
if (IOValue(IO_Type.StringBack_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Type.StringFront_Check).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.StringBack_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Type.StringFront_Check).Equals(IO_VALUE.LOW))
{ {
StringMoveInfo.NextMoveStep(MoveStep.Wait); StringMoveInfo.NextMoveStep(MoveStep.Wait);
LastStringState = StringStateE.None; LastStringState = StringStateE.None;
StringState = StringStateE.None;
StringMoveInfo.log($"料串已离开"); StringMoveInfo.log($"料串已离开");
StringMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000)); StringMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
} }
...@@ -328,7 +331,10 @@ namespace DeviceLibrary ...@@ -328,7 +331,10 @@ namespace DeviceLibrary
if (StringState == StringStateE.Empty) if (StringState == StringStateE.Empty)
state = crc.GetString(L.empty_reel, "空料串"); state = crc.GetString(L.empty_reel, "空料串");
else if (StringState == StringStateE.Full) else if (StringState == StringStateE.Full)
{
state = crc.GetString(L.full_reel, "满料串"); state = crc.GetString(L.full_reel, "满料串");
}
else if (StringState == StringStateE.HasReel) else if (StringState == StringStateE.HasReel)
state = crc.GetString(L.instore_reel, "入库料串"); state = crc.GetString(L.instore_reel, "入库料串");
else if (StringState == StringStateE.None) else if (StringState == StringStateE.None)
......
...@@ -28,7 +28,7 @@ namespace DeviceLibrary ...@@ -28,7 +28,7 @@ namespace DeviceLibrary
InitializeComponent(); InitializeComponent();
crc.OpenResourceLog = true; crc.OpenResourceLog = true;
crc.LanguageChangeEvent += Crc_LanguageChangeEvent; crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
crc.LanguageProcess(this); crc.CurrLanguage = ConfigHelper.Config.Get("Device_Default_Language", "zh-CN");
} }
private void Crc_LanguageChangeEvent(object sender, EventArgs e) private void Crc_LanguageChangeEvent(object sender, EventArgs e)
...@@ -70,6 +70,7 @@ namespace DeviceLibrary ...@@ -70,6 +70,7 @@ namespace DeviceLibrary
groupBox1.Visible = true; groupBox1.Visible = true;
groupBox2.Visible = false; groupBox2.Visible = false;
} }
crc.LanguageProcess(this);
} }
...@@ -260,7 +261,7 @@ namespace DeviceLibrary ...@@ -260,7 +261,7 @@ namespace DeviceLibrary
btnAxisReturnHome.ForeColor = color; btnAxisReturnHome.ForeColor = color;
btnAxisStop.ForeColor = color; btnAxisStop.ForeColor = color;
btnComAlarmClear.ForeColor = color; btnComAlarmClear.ForeColor = color;
btnReadPosition.ForeColor = color; //btnReadPosition.ForeColor = color;
btnGetAlarm.ForeColor = color; btnGetAlarm.ForeColor = color;
btnAddMove.ForeColor = color; btnAddMove.ForeColor = color;
btnDelMove.ForeColor = color; btnDelMove.ForeColor = color;
......
...@@ -140,7 +140,7 @@ namespace TheMachine ...@@ -140,7 +140,7 @@ namespace TheMachine
// 简体中文ToolStripMenuItem // 简体中文ToolStripMenuItem
// //
this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem"; this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem";
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.简体中文ToolStripMenuItem.Tag = "not"; this.简体中文ToolStripMenuItem.Tag = "not";
this.简体中文ToolStripMenuItem.Text = "简体中文"; this.简体中文ToolStripMenuItem.Text = "简体中文";
this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click); this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click);
...@@ -148,7 +148,7 @@ namespace TheMachine ...@@ -148,7 +148,7 @@ namespace TheMachine
// 日本语ToolStripMenuItem // 日本语ToolStripMenuItem
// //
this.日本语ToolStripMenuItem.Name = "日本语ToolStripMenuItem"; this.日本语ToolStripMenuItem.Name = "日本语ToolStripMenuItem";
this.日本语ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.日本语ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.日本语ToolStripMenuItem.Tag = "not"; this.日本语ToolStripMenuItem.Tag = "not";
this.日本语ToolStripMenuItem.Text = "日本語"; this.日本语ToolStripMenuItem.Text = "日本語";
this.日本语ToolStripMenuItem.Click += new System.EventHandler(this.日本语ToolStripMenuItem_Click); this.日本语ToolStripMenuItem.Click += new System.EventHandler(this.日本语ToolStripMenuItem_Click);
...@@ -159,6 +159,7 @@ namespace TheMachine ...@@ -159,6 +159,7 @@ namespace TheMachine
this.englishToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.englishToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.englishToolStripMenuItem.Tag = "not"; this.englishToolStripMenuItem.Tag = "not";
this.englishToolStripMenuItem.Text = "English"; this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Visible = false;
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click); this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
// //
// 关于ToolStripMenuItem // 关于ToolStripMenuItem
...@@ -214,7 +215,7 @@ namespace TheMachine ...@@ -214,7 +215,7 @@ namespace TheMachine
this.groupBox1.Controls.Add(this.stateView); this.groupBox1.Controls.Add(this.stateView);
this.groupBox1.Location = new System.Drawing.Point(3, 4); this.groupBox1.Location = new System.Drawing.Point(3, 4);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(611, 292); this.groupBox1.Size = new System.Drawing.Size(598, 292);
this.groupBox1.TabIndex = 1; this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "运行状态"; this.groupBox1.Text = "运行状态";
...@@ -228,15 +229,15 @@ namespace TheMachine ...@@ -228,15 +229,15 @@ namespace TheMachine
this.stateView.Location = new System.Drawing.Point(3, 25); this.stateView.Location = new System.Drawing.Point(3, 25);
this.stateView.MultiSelect = false; this.stateView.MultiSelect = false;
this.stateView.Name = "stateView"; this.stateView.Name = "stateView";
this.stateView.Size = new System.Drawing.Size(605, 264); this.stateView.Size = new System.Drawing.Size(592, 264);
this.stateView.TabIndex = 0; this.stateView.TabIndex = 0;
this.stateView.UseCompatibleStateImageBehavior = false; this.stateView.UseCompatibleStateImageBehavior = false;
// //
// btn_releasestring // btn_releasestring
// //
this.btn_releasestring.Location = new System.Drawing.Point(650, 213); this.btn_releasestring.Location = new System.Drawing.Point(607, 225);
this.btn_releasestring.Name = "btn_releasestring"; this.btn_releasestring.Name = "btn_releasestring";
this.btn_releasestring.Size = new System.Drawing.Size(201, 40); this.btn_releasestring.Size = new System.Drawing.Size(301, 40);
this.btn_releasestring.TabIndex = 272; this.btn_releasestring.TabIndex = 272;
this.btn_releasestring.Tag = "not"; this.btn_releasestring.Tag = "not";
this.btn_releasestring.Text = "安全释放料串"; this.btn_releasestring.Text = "安全释放料串";
...@@ -246,7 +247,7 @@ namespace TheMachine ...@@ -246,7 +247,7 @@ namespace TheMachine
// cb_IgnoreSafecheck // cb_IgnoreSafecheck
// //
this.cb_IgnoreSafecheck.AutoSize = true; this.cb_IgnoreSafecheck.AutoSize = true;
this.cb_IgnoreSafecheck.Location = new System.Drawing.Point(650, 35); this.cb_IgnoreSafecheck.Location = new System.Drawing.Point(607, 47);
this.cb_IgnoreSafecheck.Name = "cb_IgnoreSafecheck"; this.cb_IgnoreSafecheck.Name = "cb_IgnoreSafecheck";
this.cb_IgnoreSafecheck.Size = new System.Drawing.Size(215, 25); this.cb_IgnoreSafecheck.Size = new System.Drawing.Size(215, 25);
this.cb_IgnoreSafecheck.TabIndex = 2; this.cb_IgnoreSafecheck.TabIndex = 2;
...@@ -270,7 +271,7 @@ namespace TheMachine ...@@ -270,7 +271,7 @@ namespace TheMachine
// cb_IgnoreGratingSignal // cb_IgnoreGratingSignal
// //
this.cb_IgnoreGratingSignal.AutoSize = true; this.cb_IgnoreGratingSignal.AutoSize = true;
this.cb_IgnoreGratingSignal.Location = new System.Drawing.Point(650, 66); this.cb_IgnoreGratingSignal.Location = new System.Drawing.Point(607, 78);
this.cb_IgnoreGratingSignal.Name = "cb_IgnoreGratingSignal"; this.cb_IgnoreGratingSignal.Name = "cb_IgnoreGratingSignal";
this.cb_IgnoreGratingSignal.Size = new System.Drawing.Size(125, 25); this.cb_IgnoreGratingSignal.Size = new System.Drawing.Size(125, 25);
this.cb_IgnoreGratingSignal.TabIndex = 2; this.cb_IgnoreGratingSignal.TabIndex = 2;
...@@ -294,7 +295,7 @@ namespace TheMachine ...@@ -294,7 +295,7 @@ namespace TheMachine
// cb_EnableBuzzer // cb_EnableBuzzer
// //
this.cb_EnableBuzzer.AutoSize = true; this.cb_EnableBuzzer.AutoSize = true;
this.cb_EnableBuzzer.Location = new System.Drawing.Point(650, 4); this.cb_EnableBuzzer.Location = new System.Drawing.Point(607, 16);
this.cb_EnableBuzzer.Name = "cb_EnableBuzzer"; this.cb_EnableBuzzer.Name = "cb_EnableBuzzer";
this.cb_EnableBuzzer.Size = new System.Drawing.Size(109, 25); this.cb_EnableBuzzer.Size = new System.Drawing.Size(109, 25);
this.cb_EnableBuzzer.TabIndex = 5; this.cb_EnableBuzzer.TabIndex = 5;
...@@ -305,9 +306,9 @@ namespace TheMachine ...@@ -305,9 +306,9 @@ namespace TheMachine
// btn_IgnoreX09 // btn_IgnoreX09
// //
this.btn_IgnoreX09.BackColor = System.Drawing.Color.OrangeRed; this.btn_IgnoreX09.BackColor = System.Drawing.Color.OrangeRed;
this.btn_IgnoreX09.Location = new System.Drawing.Point(650, 143); this.btn_IgnoreX09.Location = new System.Drawing.Point(607, 155);
this.btn_IgnoreX09.Name = "btn_IgnoreX09"; this.btn_IgnoreX09.Name = "btn_IgnoreX09";
this.btn_IgnoreX09.Size = new System.Drawing.Size(201, 40); this.btn_IgnoreX09.Size = new System.Drawing.Size(301, 40);
this.btn_IgnoreX09.TabIndex = 6; this.btn_IgnoreX09.TabIndex = 6;
this.btn_IgnoreX09.Text = "忽略X30错误,并继续运行"; this.btn_IgnoreX09.Text = "忽略X30错误,并继续运行";
this.btn_IgnoreX09.UseVisualStyleBackColor = false; this.btn_IgnoreX09.UseVisualStyleBackColor = false;
...@@ -317,9 +318,9 @@ namespace TheMachine ...@@ -317,9 +318,9 @@ namespace TheMachine
// btn_PauseBuzzer // btn_PauseBuzzer
// //
this.btn_PauseBuzzer.BackColor = System.Drawing.Color.OrangeRed; this.btn_PauseBuzzer.BackColor = System.Drawing.Color.OrangeRed;
this.btn_PauseBuzzer.Location = new System.Drawing.Point(650, 97); this.btn_PauseBuzzer.Location = new System.Drawing.Point(607, 109);
this.btn_PauseBuzzer.Name = "btn_PauseBuzzer"; this.btn_PauseBuzzer.Name = "btn_PauseBuzzer";
this.btn_PauseBuzzer.Size = new System.Drawing.Size(201, 40); this.btn_PauseBuzzer.Size = new System.Drawing.Size(301, 40);
this.btn_PauseBuzzer.TabIndex = 6; this.btn_PauseBuzzer.TabIndex = 6;
this.btn_PauseBuzzer.Text = "本次暂停警报器响声"; this.btn_PauseBuzzer.Text = "本次暂停警报器响声";
this.btn_PauseBuzzer.UseVisualStyleBackColor = false; this.btn_PauseBuzzer.UseVisualStyleBackColor = false;
......
...@@ -30,6 +30,7 @@ namespace TheMachine ...@@ -30,6 +30,7 @@ namespace TheMachine
this.Text = Config.Get(Setting_Init.App_Title) +" "+ Config.Get("CID"); this.Text = Config.Get(Setting_Init.App_Title) +" "+ Config.Get("CID");
crc.GetLanguageEvent += Crc_GetLanguageEvent; crc.GetLanguageEvent += Crc_GetLanguageEvent;
crc.LanguageChangeEvent += Crc_LanguageChangeEvent; crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
crc.CurrLanguage = Crc_GetLanguageEvent();
t1.Interval = 1000; t1.Interval = 1000;
t1.Tick += T1_Tick; t1.Tick += T1_Tick;
t1.Start(); t1.Start();
...@@ -448,14 +449,16 @@ namespace TheMachine ...@@ -448,14 +449,16 @@ namespace TheMachine
{ {
Camera._cam.CloseAll(); Camera._cam.CloseAll();
} }
CodeLibrary.CodeResourceControl.GetLanguageEvent += Crc_GetLanguageEvent;
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode(); CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
frm.CurrLanguage = Crc_GetLanguageEvent();
frm.chbZxing.Checked = false; frm.chbZxing.Checked = false;
frm.ShowDialog(); frm.ShowDialog();
frm.Dispose(); frm.Dispose();
//IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW); //IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
} }
private void 关于ToolStripMenuItem_Click(object sender, EventArgs e) private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
AboutBox1 aboutBox1 = new AboutBox1(); AboutBox1 aboutBox1 = new AboutBox1();
......
...@@ -48,7 +48,7 @@ namespace TheMachine ...@@ -48,7 +48,7 @@ namespace TheMachine
// //
this.btn_linerun.Location = new System.Drawing.Point(566, 382); this.btn_linerun.Location = new System.Drawing.Point(566, 382);
this.btn_linerun.Name = "btn_linerun"; this.btn_linerun.Name = "btn_linerun";
this.btn_linerun.Size = new System.Drawing.Size(94, 23); this.btn_linerun.Size = new System.Drawing.Size(113, 23);
this.btn_linerun.TabIndex = 2; this.btn_linerun.TabIndex = 2;
this.btn_linerun.Text = "线体正转"; this.btn_linerun.Text = "线体正转";
this.btn_linerun.UseVisualStyleBackColor = true; this.btn_linerun.UseVisualStyleBackColor = true;
...@@ -56,9 +56,9 @@ namespace TheMachine ...@@ -56,9 +56,9 @@ namespace TheMachine
// //
// btn_linerev // btn_linerev
// //
this.btn_linerev.Location = new System.Drawing.Point(666, 382); this.btn_linerev.Location = new System.Drawing.Point(685, 382);
this.btn_linerev.Name = "btn_linerev"; this.btn_linerev.Name = "btn_linerev";
this.btn_linerev.Size = new System.Drawing.Size(94, 23); this.btn_linerev.Size = new System.Drawing.Size(105, 23);
this.btn_linerev.TabIndex = 2; this.btn_linerev.TabIndex = 2;
this.btn_linerev.Text = "线体反转"; this.btn_linerev.Text = "线体反转";
this.btn_linerev.UseVisualStyleBackColor = true; this.btn_linerev.UseVisualStyleBackColor = true;
...@@ -68,7 +68,7 @@ namespace TheMachine ...@@ -68,7 +68,7 @@ namespace TheMachine
// //
this.btn_linestop.Location = new System.Drawing.Point(566, 411); this.btn_linestop.Location = new System.Drawing.Point(566, 411);
this.btn_linestop.Name = "btn_linestop"; this.btn_linestop.Name = "btn_linestop";
this.btn_linestop.Size = new System.Drawing.Size(194, 23); this.btn_linestop.Size = new System.Drawing.Size(224, 23);
this.btn_linestop.TabIndex = 2; this.btn_linestop.TabIndex = 2;
this.btn_linestop.Text = "线体停止"; this.btn_linestop.Text = "线体停止";
this.btn_linestop.UseVisualStyleBackColor = true; this.btn_linestop.UseVisualStyleBackColor = true;
...@@ -82,7 +82,7 @@ namespace TheMachine ...@@ -82,7 +82,7 @@ namespace TheMachine
this.cylinderButton5.IO_LOW = "StringPosChecker_Home"; this.cylinderButton5.IO_LOW = "StringPosChecker_Home";
this.cylinderButton5.Location = new System.Drawing.Point(566, 342); this.cylinderButton5.Location = new System.Drawing.Point(566, 342);
this.cylinderButton5.Name = "cylinderButton5"; this.cylinderButton5.Name = "cylinderButton5";
this.cylinderButton5.Size = new System.Drawing.Size(194, 23); this.cylinderButton5.Size = new System.Drawing.Size(224, 23);
this.cylinderButton5.TabIndex = 1; this.cylinderButton5.TabIndex = 1;
this.cylinderButton5.Tag = "not"; this.cylinderButton5.Tag = "not";
this.cylinderButton5.Text = "StringPosChecker_Work"; this.cylinderButton5.Text = "StringPosChecker_Work";
...@@ -96,7 +96,7 @@ namespace TheMachine ...@@ -96,7 +96,7 @@ namespace TheMachine
this.cylinderButton4.IO_LOW = "Clamping_Relax"; this.cylinderButton4.IO_LOW = "Clamping_Relax";
this.cylinderButton4.Location = new System.Drawing.Point(566, 313); this.cylinderButton4.Location = new System.Drawing.Point(566, 313);
this.cylinderButton4.Name = "cylinderButton4"; this.cylinderButton4.Name = "cylinderButton4";
this.cylinderButton4.Size = new System.Drawing.Size(194, 23); this.cylinderButton4.Size = new System.Drawing.Size(224, 23);
this.cylinderButton4.TabIndex = 1; this.cylinderButton4.TabIndex = 1;
this.cylinderButton4.Tag = "not"; this.cylinderButton4.Tag = "not";
this.cylinderButton4.Text = "Clamping_Work"; this.cylinderButton4.Text = "Clamping_Work";
...@@ -110,7 +110,7 @@ namespace TheMachine ...@@ -110,7 +110,7 @@ namespace TheMachine
this.cylinderButton3.IO_LOW = "StringDoor_Close"; this.cylinderButton3.IO_LOW = "StringDoor_Close";
this.cylinderButton3.Location = new System.Drawing.Point(566, 284); this.cylinderButton3.Location = new System.Drawing.Point(566, 284);
this.cylinderButton3.Name = "cylinderButton3"; this.cylinderButton3.Name = "cylinderButton3";
this.cylinderButton3.Size = new System.Drawing.Size(194, 23); this.cylinderButton3.Size = new System.Drawing.Size(224, 23);
this.cylinderButton3.TabIndex = 1; this.cylinderButton3.TabIndex = 1;
this.cylinderButton3.Tag = "not"; this.cylinderButton3.Tag = "not";
this.cylinderButton3.Text = "StringDoor_Open"; this.cylinderButton3.Text = "StringDoor_Open";
...@@ -124,7 +124,7 @@ namespace TheMachine ...@@ -124,7 +124,7 @@ namespace TheMachine
this.cylinderButton2.IO_LOW = "StringFix_Bottom"; this.cylinderButton2.IO_LOW = "StringFix_Bottom";
this.cylinderButton2.Location = new System.Drawing.Point(566, 255); this.cylinderButton2.Location = new System.Drawing.Point(566, 255);
this.cylinderButton2.Name = "cylinderButton2"; this.cylinderButton2.Name = "cylinderButton2";
this.cylinderButton2.Size = new System.Drawing.Size(194, 23); this.cylinderButton2.Size = new System.Drawing.Size(224, 23);
this.cylinderButton2.TabIndex = 1; this.cylinderButton2.TabIndex = 1;
this.cylinderButton2.Tag = "not"; this.cylinderButton2.Tag = "not";
this.cylinderButton2.Text = "StringFix_Top"; this.cylinderButton2.Text = "StringFix_Top";
...@@ -138,7 +138,7 @@ namespace TheMachine ...@@ -138,7 +138,7 @@ namespace TheMachine
this.cylinderButton7.IO_LOW = ""; this.cylinderButton7.IO_LOW = "";
this.cylinderButton7.Location = new System.Drawing.Point(566, 168); this.cylinderButton7.Location = new System.Drawing.Point(566, 168);
this.cylinderButton7.Name = "cylinderButton7"; this.cylinderButton7.Name = "cylinderButton7";
this.cylinderButton7.Size = new System.Drawing.Size(194, 23); this.cylinderButton7.Size = new System.Drawing.Size(224, 23);
this.cylinderButton7.TabIndex = 1; this.cylinderButton7.TabIndex = 1;
this.cylinderButton7.Tag = "not"; this.cylinderButton7.Tag = "not";
this.cylinderButton7.Text = "Device_Led"; this.cylinderButton7.Text = "Device_Led";
...@@ -152,7 +152,7 @@ namespace TheMachine ...@@ -152,7 +152,7 @@ namespace TheMachine
this.cylinderButton6.IO_LOW = ""; this.cylinderButton6.IO_LOW = "";
this.cylinderButton6.Location = new System.Drawing.Point(566, 197); this.cylinderButton6.Location = new System.Drawing.Point(566, 197);
this.cylinderButton6.Name = "cylinderButton6"; this.cylinderButton6.Name = "cylinderButton6";
this.cylinderButton6.Size = new System.Drawing.Size(194, 23); this.cylinderButton6.Size = new System.Drawing.Size(224, 23);
this.cylinderButton6.TabIndex = 1; this.cylinderButton6.TabIndex = 1;
this.cylinderButton6.Tag = "not"; this.cylinderButton6.Tag = "not";
this.cylinderButton6.Text = "Camera_Led"; this.cylinderButton6.Text = "Camera_Led";
...@@ -166,7 +166,7 @@ namespace TheMachine ...@@ -166,7 +166,7 @@ namespace TheMachine
this.cylinderButton1.IO_LOW = "NGDoor_Close"; this.cylinderButton1.IO_LOW = "NGDoor_Close";
this.cylinderButton1.Location = new System.Drawing.Point(566, 226); this.cylinderButton1.Location = new System.Drawing.Point(566, 226);
this.cylinderButton1.Name = "cylinderButton1"; this.cylinderButton1.Name = "cylinderButton1";
this.cylinderButton1.Size = new System.Drawing.Size(194, 23); this.cylinderButton1.Size = new System.Drawing.Size(224, 23);
this.cylinderButton1.TabIndex = 1; this.cylinderButton1.TabIndex = 1;
this.cylinderButton1.Tag = "not"; this.cylinderButton1.Tag = "not";
this.cylinderButton1.Text = "NGDoor_Open"; this.cylinderButton1.Text = "NGDoor_Open";
...@@ -187,7 +187,7 @@ namespace TheMachine ...@@ -187,7 +187,7 @@ namespace TheMachine
// //
this.btn_flipopen.Location = new System.Drawing.Point(566, 453); this.btn_flipopen.Location = new System.Drawing.Point(566, 453);
this.btn_flipopen.Name = "btn_flipopen"; this.btn_flipopen.Name = "btn_flipopen";
this.btn_flipopen.Size = new System.Drawing.Size(94, 23); this.btn_flipopen.Size = new System.Drawing.Size(113, 23);
this.btn_flipopen.TabIndex = 3; this.btn_flipopen.TabIndex = 3;
this.btn_flipopen.Text = "翻版托盘打开"; this.btn_flipopen.Text = "翻版托盘打开";
this.btn_flipopen.UseVisualStyleBackColor = true; this.btn_flipopen.UseVisualStyleBackColor = true;
...@@ -195,9 +195,9 @@ namespace TheMachine ...@@ -195,9 +195,9 @@ namespace TheMachine
// //
// btn_flipclose // btn_flipclose
// //
this.btn_flipclose.Location = new System.Drawing.Point(666, 453); this.btn_flipclose.Location = new System.Drawing.Point(685, 453);
this.btn_flipclose.Name = "btn_flipclose"; this.btn_flipclose.Name = "btn_flipclose";
this.btn_flipclose.Size = new System.Drawing.Size(94, 23); this.btn_flipclose.Size = new System.Drawing.Size(105, 23);
this.btn_flipclose.TabIndex = 3; this.btn_flipclose.TabIndex = 3;
this.btn_flipclose.Text = "翻版托盘合拢"; this.btn_flipclose.Text = "翻版托盘合拢";
this.btn_flipclose.UseVisualStyleBackColor = true; this.btn_flipclose.UseVisualStyleBackColor = true;
......
...@@ -145,19 +145,19 @@ namespace TheMachine ...@@ -145,19 +145,19 @@ namespace TheMachine
if (io_state.Equals(IO_VALUE.LOW)) if (io_state.Equals(IO_VALUE.LOW))
{ {
LogUtil.info($"手动点击: Set {configio_high.DeviceName}=HIGH"); LogUtil.info($"手动点击: Set {configio_high.ElectricalDefinition}{configio_high.Explain}=HIGH");
IOManager.WriteSingleDO(configio_high.DeviceName, configio_high.SlaveID, configio_high.GetIOAddr(), IO_VALUE.HIGH); IOManager.WriteSingleDO(configio_high.DeviceName, configio_high.SlaveID, configio_high.GetIOAddr(), IO_VALUE.HIGH);
if (configio_low != null) if (configio_low != null)
IOManager.WriteSingleDO(configio_low.DeviceName, configio_low.SlaveID, configio_low.GetIOAddr(), IO_VALUE.LOW); IOManager.WriteSingleDO(configio_low.DeviceName, configio_low.SlaveID, configio_low.GetIOAddr(), IO_VALUE.LOW);
} }
else if (configio_low != null) else if (configio_low != null)
{ {
LogUtil.info($"手动点击: Set {configio_high.DeviceName}=LOW"); LogUtil.info($"手动点击: Set {configio_high.ElectricalDefinition}{configio_high.Explain}=LOW");
IOManager.WriteSingleDO(configio_high.DeviceName, configio_high.SlaveID, configio_high.GetIOAddr(), IO_VALUE.LOW); IOManager.WriteSingleDO(configio_high.DeviceName, configio_high.SlaveID, configio_high.GetIOAddr(), IO_VALUE.LOW);
IOManager.WriteSingleDO(configio_low.DeviceName, configio_low.SlaveID, configio_low.GetIOAddr(), IO_VALUE.HIGH); IOManager.WriteSingleDO(configio_low.DeviceName, configio_low.SlaveID, configio_low.GetIOAddr(), IO_VALUE.HIGH);
} }
else { else {
LogUtil.info($"手动点击: Set {configio_high.DeviceName}=LOW"); LogUtil.info($"手动点击: Set {configio_high.ElectricalDefinition}{configio_high.Explain}=LOW");
IOManager.WriteSingleDO(configio_high.DeviceName, configio_high.SlaveID, configio_high.GetIOAddr(), IO_VALUE.LOW); IOManager.WriteSingleDO(configio_high.DeviceName, configio_high.SlaveID, configio_high.GetIOAddr(), IO_VALUE.LOW);
} }
} }
......
...@@ -44,6 +44,8 @@ namespace TheMachine ...@@ -44,6 +44,8 @@ namespace TheMachine
private ACStorePosition _aCStorePosition; private ACStorePosition _aCStorePosition;
public void LoadPos(ACStorePosition aCStorePosition) public void LoadPos(ACStorePosition aCStorePosition)
{ {
if (aCStorePosition == null)
return;
_aCStorePosition = aCStorePosition; _aCStorePosition = aCStorePosition;
tableLayoutPanel1.SuspendLayout(); tableLayoutPanel1.SuspendLayout();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!