Commit e35141b7 刘韬

调试通过

1 个父辈 2fc1e625
using log4net;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Layout;
namespace OnlineStore
{
public class CodeResourceControl
{
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 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>>();
public delegate string GetLanguageDelegate();
public static event GetLanguageDelegate GetLanguageEvent;
public delegate void RefreshLanguageDelegate();
public static event RefreshLanguageDelegate RefreshLanguageEvent;
public static string GetLanguage()
{
if (GetLanguageEvent == null)
{
return China;
}
string result = GetLanguageEvent?.Invoke();
if (result == null)
{
return "";
}
return result;
}
private static string spiltStr = "_";
private static string Text = "Text";
public static string GetTextIdStr(string className, string controlName)
{
return className + spiltStr + controlName + spiltStr + Text;
}
public static string GetTextIdStr(string className)
{
return className + spiltStr + Text;
}
public static string GetString(string id, string defaultStr)
{
string strCurLanguage = defaultStr;
var haslang = getLangRes(CurrLanguage);
if (!haslang) {
return strCurLanguage;
}
try
{
LangMap[CurrLanguage].TryGetValue(id, out strCurLanguage);
if ((strCurLanguage == null || strCurLanguage.Equals("")) && (!defaultStr.Equals("")))
{
strCurLanguage = defaultStr;
NoIdLog(id, defaultStr);
}
}
catch (Exception ex)
{
if (defaultStr.Equals(""))
{
}
else
{
strCurLanguage = "No id:[" + id + "], please add.";
strCurLanguage = defaultStr;
NoIdLog(id, defaultStr);
}
}
if (strCurLanguage == null)
{
strCurLanguage = "";
}
return strCurLanguage;
}
public static string GetString(string id, string defaultStr, params object[] param)
{
string strCurLanguage = GetString(id, defaultStr);
return String.Format(strCurLanguage, param);
}
private static void NoIdLog(string id, string defaultStr)
{
if (OpenResourceLog)
{
if (!LangMap["zh-CN"].ContainsKey(id) && checkInterid(id))
LOG.Info("No Res id:" + id + "#" + defaultStr);
}
}
private static bool checkInterid(string id) {
string[] interstring = new string[] { "_txt", "_lbl" };
var x = from a in interstring
where id.IndexOf(a) > -1
select a;
return x.Count() == 0;
}
static CodeResourceControl()
{
}
private static bool getLangRes(string lang) {
if (!LangMap.ContainsKey(lang)) {
string path = Application.StartupPath + @"\resources\"+lang+".txt";
if (!File.Exists(path))
{
return false;
}
string[] lines = File.ReadAllLines(path);
var map = new Dictionary<string, string>();
foreach (string line in lines)
{
string[] array = line.Split('#');
if (array.Length >= 3)
{
string key = array[0];
string chinese = array[1];
string english = array[2];
if (map.ContainsKey(key))
{
map.Remove(key);
}
map.Add(key, english);
}
}
LangMap.Add(lang, map);
return true;
}
return true;
}
public static string CurrLanguage = "";
public static void LanguageProcess(ContainerControl cc, string className)
{
if (CurrLanguage.Equals(CodeResourceControl.GetLanguage()))
{
//return;
}
//string className = cc.ClassName;
CurrLanguage = CodeResourceControl.GetLanguage();
string name = CodeResourceControl.GetString(CodeResourceControl.GetTextIdStr(className), cc.Text);
if (!name.Equals("")) { cc.Text = name; }
PreControlLanaguage(cc, className);
RefreshLanguageEvent?.Invoke();
}
private static void PreControlLanaguage(Control partentControl, string className)
{
//string className = this.ClassName;
Con_GetTxt(partentControl, out string title);
string newStr = GetString(GetTextIdStr(className, partentControl.Name), title);
if (!newStr.Equals(""))
{
Con_SetTxt(partentControl, newStr.Replace("\\n", "\n"));
}
foreach (Control con in partentControl.Controls)
{
string txt = "";
bool haslang = false;
if (con.Tag != null && con.Tag.ToString() == "not")
{
continue;
}
if (Con_GetTxt(con, out txt))
{
newStr = GetString(GetTextIdStr(className, con.Name), txt);
if (!newStr.Equals(""))
{
Con_SetTxt(con, newStr.Replace("\\n", "\n"));
//haslang = true;
}
}
if (con.Tag !=null && con.Tag.ToString() == "nochiled")
{
continue;
}
if (con.Controls.Count > 0 && !haslang)
{
PreControlLanaguage(con, className+"_"+ con.Name);
}
//Console.WriteLine(con is IList<Component>);
//Console.WriteLine(con is IList<Component>);
}
}
public static void ProcessListItem<T>(T con,string ClassName) where T: ToolStripItemCollection
{
for (int i = 0; i < con.Count; i++) {
if (con[i].Tag != null && con[i].Tag.ToString() == "not")
{
continue;
}
string txt = con[i].Text;
string newStr = GetString(GetTextIdStr(ClassName, con[i].Name), txt);
if (!newStr.Equals(""))
{
con[i].Text= newStr.Replace("\\n", "\n");
//haslang = true;
}
if (con[i] is ToolStripMenuItem) {
var tt = ((ToolStripMenuItem)con[i]);
ProcessListItem(tt.DropDownItems, tt.Name);
}
}
}
static bool Con_GetTxt(Control con, out string txt)
{
txt = "";
if (con is Label || con is Button || con is RadioButton || con is CheckBox)
{
txt = con.Text;
return true;
}
string methodname = getMethodname(con);
var t = con.GetType();
var p = t.GetProperty(methodname);
if (p != null)
{
txt = p.GetValue(con, null).ToString();
return true;
}
return false;
}
static void Con_SetTxt(Control con, string txt)
{
if (con is Label || con is Button || con is RadioButton || con is CheckBox)
{
con.Text = txt;
return;
}
string methodname = getMethodname(con);
var t = con.GetType();
var p = t.GetProperty(methodname);
if (p == null)
return;
else
p.SetValue(con, txt,null);
}
static string getMethodname(Control con) {
string methodname = "Text";
//if (con is UCBtnExt) methodname = "BtnText";
//if (con is UCTextBoxEx) methodname = "InputText";
//if (con is UCCheckBox) methodname = "TextValue";
//if (con is UCPanelTitle || con is FrmWithTitle) methodname = "Title";
//if (con is Form) methodname = "Title";
return methodname;
}
}
}
......@@ -52,6 +52,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="bean\Bean.cs" />
<Compile Include="CodeResourceControl.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting_Init.cs" />
<Compile Include="util\AcSerialBean.cs" />
......
......@@ -98,6 +98,7 @@ namespace OnlineStore.Common
public static string CurrShelfNum = "CurrShelfNum";
public static string CurrShelfType = "CurrShelfType";
public static string code_block_size_list = "code_block_size_list";
public static string yuscan= "yuscan";
}
}
......@@ -236,5 +236,6 @@ namespace OnlineStore.Common
/// 真实料架号,可能为空
/// </summary>
public static string realRfid = "realRfid";
public static string singleOut = "singleOut";
}
}
......@@ -49,6 +49,10 @@ namespace OnlineStore.Common
}
public static Operation PostOperation(string url, Operation operation, bool simulate = false)
{
LogUtil.OutputDebugString("PostOperation");
lock (serverLock)
{
LogUtil.OutputDebugString("PostOperation lock");
try
{
if (operation == null)
......@@ -91,11 +95,12 @@ namespace OnlineStore.Common
{
try
{
Operation reOP= JsonHelper.DeserializeJsonToObject<Operation>(result);
if (isLog == 1||(reOP.op>0 && reOP.op!=5))
Operation reOP = JsonHelper.DeserializeJsonToObject<Operation>(result);
if (isLog == 1 || (reOP.op > 0 && reOP.op != 5))
{
LogUtil.info("【"+url+"】发送【" + json + "】收到【" + result + "】\r\n["+JsonHelper.SerializeObject(reOP) +"]");
LogUtil.info("【" + url + "】发送【" + json + "】收到【" + result + "】\r\n[" + JsonHelper.SerializeObject(reOP) + "]");
}
LogUtil.OutputDebugString("【" + url + "】发送【" + json + "】收到【" + result + "】\r\n[" + JsonHelper.SerializeObject(reOP) + "]");
return reOP;
}
catch (Exception ex)
......@@ -120,9 +125,12 @@ namespace OnlineStore.Common
}
return null;
}
}
static object serverLock = new object();
public static string Post(string url, string paramData, Encoding encoding, int timeOut, out bool IsTimeOut)
{
lock (serverLock)
{
if (paramData.Equals(""))
{
int index = url.IndexOf("?");
......@@ -152,6 +160,7 @@ namespace OnlineStore.Common
wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData);
LogUtil.OutputDebugString($"url: {url} , paramData:{paramData} ,result:{result}");
//LogUtil.info(result);
}
catch (WebException ex)
......@@ -170,6 +179,7 @@ namespace OnlineStore.Common
}
return result;
}
}
public static string Get(string url)
{
......@@ -178,15 +188,17 @@ namespace OnlineStore.Common
public static string Get(string url, Encoding encoding)
{
lock (serverLock)
{
try
{
LogUtil.info( "HTTP GET FROM: " + url);
LogUtil.info("HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding };
var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding))
{
var result = sr.ReadToEnd();
LogUtil.info( "receive << " + result);
LogUtil.info("receive << " + result);
return result;
}
}
......@@ -197,4 +209,5 @@ namespace OnlineStore.Common
return "";
}
}
}
}
\ No newline at end of file
......@@ -196,6 +196,7 @@ namespace OnlineStore.Common
{
info(LOGGER, msg);
}
[System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
public static extern void OutputDebugString(string message);
}
}
......@@ -36,7 +36,7 @@
<add key="OutStoreWaitSeconds" value="1" />
<!--温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪-->
<add key="HumitureControllerType" value="0" />
<add key="Default_Language" value="zh-CN" />
<add key="UseBuzzer" value="0" />
<!--IO模块是否主动上传-->
<add key="AIOAutoUpload" value="0" />
......@@ -55,6 +55,7 @@
<add key ="CurrShelfNum" value ="-1"/>
<!--当前料架信息-料架类型,0=空料架,1=入库料架,2=出库料架-->
<add key ="CurrShelfType" value ="-1"/>
<add key ="Code_Block_Size_List" value ="17,19"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......@@ -77,6 +78,16 @@
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<appender name="LngResource" type="log4net.Appender.RollingFileAppender">
<file value="logs/LngResource.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
......@@ -85,6 +96,10 @@
<level value="Info" />
<appender-ref ref="AIOBOX" />
</logger>
<logger name="LngResource">
<level value="Info" />
<appender-ref ref="LngResource" />
</logger>
<!--<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
......
......@@ -29,10 +29,10 @@ namespace OnlineStore.DUOStore
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.chbDebug = new System.Windows.Forms.CheckBox();
this.lblMoveInfo = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.groupBox_do = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.lblTemp = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox_di = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage4 = new System.Windows.Forms.TabPage();
......@@ -102,7 +102,7 @@ namespace OnlineStore.DUOStore
this.axisMoveControl1 = new OnlineStore.DUOStore.AxisMoveControl();
this.btnDoorDown = new System.Windows.Forms.Button();
this.btnDoorUp = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.groupBox_devicestate = new System.Windows.Forms.GroupBox();
this.lblCanOut = new System.Windows.Forms.Label();
this.lblMoveEquipInfo = new System.Windows.Forms.Label();
this.btnSotreReset = new System.Windows.Forms.Button();
......@@ -111,14 +111,14 @@ namespace OnlineStore.DUOStore
this.lblWarnMsg = new System.Windows.Forms.Label();
this.lblThisSta = new System.Windows.Forms.Label();
this.chbDisable = new System.Windows.Forms.CheckBox();
this.groupBox4.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox_do.SuspendLayout();
this.groupBox_di.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage4.SuspendLayout();
this.groupInout.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox7.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox_devicestate.SuspendLayout();
this.SuspendLayout();
//
// timer1
......@@ -149,16 +149,17 @@ namespace OnlineStore.DUOStore
this.lblMoveInfo.TabIndex = 269;
this.lblMoveInfo.Text = "运转状态";
//
// groupBox4
// groupBox_do
//
this.groupBox4.Controls.Add(this.tableLayoutPanel2);
this.groupBox4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox4.Location = new System.Drawing.Point(5, 109);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(228, 198);
this.groupBox4.TabIndex = 270;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "DO列表";
this.groupBox_do.Controls.Add(this.tableLayoutPanel2);
this.groupBox_do.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox_do.Location = new System.Drawing.Point(5, 109);
this.groupBox_do.Name = "groupBox_do";
this.groupBox_do.Size = new System.Drawing.Size(228, 198);
this.groupBox_do.TabIndex = 270;
this.groupBox_do.TabStop = false;
this.groupBox_do.Tag = "nochiled";
this.groupBox_do.Text = "DO列表";
//
// tableLayoutPanel2
//
......@@ -187,16 +188,17 @@ namespace OnlineStore.DUOStore
this.lblTemp.TabIndex = 270;
this.lblTemp.Text = "当前温度--,当前湿度--";
//
// groupBox1
// groupBox_di
//
this.groupBox1.Controls.Add(this.tableLayoutPanel1);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(5, 310);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(228, 198);
this.groupBox1.TabIndex = 269;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "DI列表";
this.groupBox_di.Controls.Add(this.tableLayoutPanel1);
this.groupBox_di.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox_di.Location = new System.Drawing.Point(5, 310);
this.groupBox_di.Name = "groupBox_di";
this.groupBox_di.Size = new System.Drawing.Size(228, 198);
this.groupBox_di.TabIndex = 269;
this.groupBox_di.TabStop = false;
this.groupBox_di.Tag = "nochiled";
this.groupBox_di.Text = "DI列表";
//
// tableLayoutPanel1
//
......@@ -1234,23 +1236,23 @@ namespace OnlineStore.DUOStore
this.btnDoorUp.UseVisualStyleBackColor = false;
this.btnDoorUp.Click += new System.EventHandler(this.btnDoorUp_Click);
//
// groupBox3
// groupBox_devicestate
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.groupBox_devicestate.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Controls.Add(this.lblCanOut);
this.groupBox3.Controls.Add(this.lblMoveEquipInfo);
this.groupBox3.Controls.Add(this.btnSotreReset);
this.groupBox3.Controls.Add(this.btnStoreStop);
this.groupBox3.Controls.Add(this.btnStoreStart);
this.groupBox3.Controls.Add(this.lblWarnMsg);
this.groupBox3.Controls.Add(this.lblThisSta);
this.groupBox3.Location = new System.Drawing.Point(5, 2);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(1075, 105);
this.groupBox3.TabIndex = 268;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "设备状态";
this.groupBox_devicestate.Controls.Add(this.lblCanOut);
this.groupBox_devicestate.Controls.Add(this.lblMoveEquipInfo);
this.groupBox_devicestate.Controls.Add(this.btnSotreReset);
this.groupBox_devicestate.Controls.Add(this.btnStoreStop);
this.groupBox_devicestate.Controls.Add(this.btnStoreStart);
this.groupBox_devicestate.Controls.Add(this.lblWarnMsg);
this.groupBox_devicestate.Controls.Add(this.lblThisSta);
this.groupBox_devicestate.Location = new System.Drawing.Point(5, 2);
this.groupBox_devicestate.Name = "groupBox_devicestate";
this.groupBox_devicestate.Size = new System.Drawing.Size(1075, 105);
this.groupBox_devicestate.TabIndex = 268;
this.groupBox_devicestate.TabStop = false;
this.groupBox_devicestate.Text = "设备状态";
//
// lblCanOut
//
......@@ -1303,7 +1305,7 @@ namespace OnlineStore.DUOStore
this.btnStoreStart.Name = "btnStoreStart";
this.btnStoreStart.Size = new System.Drawing.Size(128, 39);
this.btnStoreStart.TabIndex = 0;
this.btnStoreStart.Text = "启动调试";
this.btnStoreStart.Text = "启动";
this.btnStoreStart.UseVisualStyleBackColor = true;
this.btnStoreStart.Click += new System.EventHandler(this.btnStoreStart_Click);
//
......@@ -1349,14 +1351,14 @@ namespace OnlineStore.DUOStore
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1084, 623);
this.Controls.Add(this.chbDisable);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox_do);
this.Controls.Add(this.chbDebug);
this.Controls.Add(this.lblTemp);
this.Controls.Add(this.btnDoorDown);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox_di);
this.Controls.Add(this.btnDoorUp);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox_devicestate);
this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4);
......@@ -1364,8 +1366,8 @@ namespace OnlineStore.DUOStore
this.Text = "AC_SA_料仓";
this.Load += new System.EventHandler(this.FrmTest_Load);
this.Shown += new System.EventHandler(this.FrmStoreBox_Shown);
this.groupBox4.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox_do.ResumeLayout(false);
this.groupBox_di.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
......@@ -1374,8 +1376,8 @@ namespace OnlineStore.DUOStore
this.tabPage1.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox_devicestate.ResumeLayout(false);
this.groupBox_devicestate.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
......@@ -1386,7 +1388,7 @@ namespace OnlineStore.DUOStore
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label lblThisSta;
private System.Windows.Forms.Label lblWarnMsg;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox_devicestate;
private System.Windows.Forms.Label lblTemp;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
......@@ -1430,9 +1432,9 @@ namespace OnlineStore.DUOStore
private System.Windows.Forms.ComboBox cmbPosition;
private System.Windows.Forms.Button btnInStore;
private System.Windows.Forms.Button btnOutStore;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.GroupBox groupBox_do;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox_di;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button btnDoorDown;
private System.Windows.Forms.Button btnDoorUp;
......
......@@ -22,6 +22,7 @@ using UserFromControl;
namespace OnlineStore.DUOStore
{
using crc = CodeResourceControl;
public partial class FrmBox : FrmBase
{
......@@ -125,18 +126,18 @@ namespace OnlineStore.DUOStore
lblMoveInfo.Text = BoxBean.GetMoveStr();
if (BoxBean.MoveInfo.MoveType.Equals(MoveType.InStore))
{
lblMoveEquipInfo.Text = "入库:" + BoxBean.MoveInfo.MoveParam.ToStr();
lblMoveEquipInfo.Text = crc.GetString("instore","入库:") + BoxBean.MoveInfo.MoveParam.ToStr();
}
else if (BoxBean.MoveInfo.MoveType.Equals(MoveType.OutStore))
{
lblMoveEquipInfo.Text = "出库:" + BoxBean.MoveInfo.MoveParam.ToStr();
lblMoveEquipInfo.Text = crc.GetString("outstore","出库:") + BoxBean.MoveInfo.MoveParam.ToStr();
}
else
{
lblMoveEquipInfo.Text = "";
// lblMoveEquipInfo.Text = "";
}
lblCanOut.Text = StoreManager.Store.CanOut() ? "可出库" : "不可出库";
lblCanOut.Text = StoreManager.Store.CanOut() ? crc.GetString("can_outstore","可出库") : crc.GetString("cant_outstore","不可出库");
//ReadPosistion();
if (BoxBean.runStatus > StoreRunStatus.Wait)
{
......@@ -179,9 +180,9 @@ namespace OnlineStore.DUOStore
{
string msg = BoxBean.AutoInout.autoMsg;
lblMsg.Text = msg;
if (btnStartAuTo.Text.Equals("开始自动出入库"))
if (btnStartAuTo.Text.Equals(crc.GetString("start_autoinout","开始自动出入库")))
{
btnStartAuTo.Text = "停止自动出入库";
btnStartAuTo.Text = crc.GetString("stop_autoinout", "停止自动出入库");
}
try
{
......@@ -198,17 +199,17 @@ namespace OnlineStore.DUOStore
else
{
// lblMsg.Text = "没有开启自动出入库";
if (btnStartAuTo.Text.Equals("停止自动出入库"))
if (btnStartAuTo.Text.Equals(crc.GetString("stop_autoinout", "停止自动出入库")))
{
btnStartAuTo.Text = "开始自动出入库";
btnStartAuTo.Text = crc.GetString("start_autoinout", "开始自动出入库");
}
}
}
else
{
lblThisSta.Text = "等待启动";
lblThisSta.Text = crc.GetString("wait_start","等待启动");
// lblWarnMsg.Text = "";
btnStartAuTo.Text = "开始自动出入库";
btnStartAuTo.Text = crc.GetString("start_autoinout", "开始自动出入库");
}
}
......@@ -218,12 +219,12 @@ namespace OnlineStore.DUOStore
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
InOutParam param = new InOutParam(MoveType.OutStore, "", selectPositionNum, ktk);
InOutParam param = new InOutParam(MoveType.OutStore, "#test#", selectPositionNum, ktk);
BoxBean.StartOutStoreMove(param);
}
else
{
MessageBox.Show("请先启动料仓!");
MessageBox.Show(crc.GetString("start_store_first","请先启动料仓!"));
}
}
......@@ -233,11 +234,11 @@ namespace OnlineStore.DUOStore
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
BoxBean.StartInStoreMove(new InOutParam(MoveType.InStore, "", selectPositionNum, ktk));
BoxBean.StartInStoreMove(new InOutParam(MoveType.InStore, "#test#", selectPositionNum, ktk));
}
else
{
MessageBox.Show("请先启动料仓!");
MessageBox.Show(crc.GetString("start_store_first", "请先启动料仓!"));
}
}
......@@ -285,7 +286,7 @@ namespace OnlineStore.DUOStore
txtMiddleP2.Text = acPosition.MiddleAxis_P2.ToString();
int comP2 = BoxBean.Config.GetComP2(acPosition.BagHigh);
txtComP2.Text = comP2.ToString();
lblSize.Text = "尺寸:" + acPosition.BagWidth + "*" + acPosition.BagHigh;
lblSize.Text = crc.GetString("size","尺寸")+":" + acPosition.BagWidth + "*" + acPosition.BagHigh;
}
}
......@@ -316,7 +317,7 @@ namespace OnlineStore.DUOStore
bool result = CSVPositionReader<ACBoxPosition>.SavePostion(positionConfigFile, acPosition);
if (!result)
{
MessageBox.Show("库位【" + selectPositionNum + "】保存失败!");
MessageBox.Show(crc.GetString("pos_save_fail","库位【{0}】保存失败!", selectPositionNum));
}
//料仓固定位置保存
bool needUpdate = false;
......@@ -420,7 +421,7 @@ namespace OnlineStore.DUOStore
{
return true;
}
MessageBox.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
MessageBox.Show(crc.GetString("fixture_not_onpos_msg","叉子不在待机位,请先将叉子退回待机位({0})", InOutDefaultPosition), crc.GetString("fixture_not_onpos_title", "警告(叉子在待机位时,才能移动升降轴和旋转轴)"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
......@@ -532,7 +533,7 @@ namespace OnlineStore.DUOStore
if (BoxBean.AutoInout.autoNext)
{
BoxBean.AutoInout.StopAuto();
btnStartAuTo.Text = "开始自动出入库";
btnStartAuTo.Text = crc.GetString("start_autoinout", "开始自动出入库");
}
else
{
......@@ -549,13 +550,13 @@ namespace OnlineStore.DUOStore
//BoxBean.StartOutStoreMove(new InOutStoreParam("", poText));
BoxBean.StartInStoreMove(new InOutParam(MoveType.InStore, "", poText));
btnStartAuTo.Text = "停止自动出入库";
btnStartAuTo.Text = crc.GetString("stop_autoinout", "停止自动出入库");
}
}
}
else
{
MessageBox.Show("请先启动料仓!");
MessageBox.Show(crc.GetString("start_store_first", "请先启动料仓!"));
}
}
private void btnAxisP_Click(object sender, EventArgs e)
......@@ -587,7 +588,7 @@ namespace OnlineStore.DUOStore
}
else
{
MessageBox.Show("请先启动料仓!");
MessageBox.Show(crc.GetString("start_store_first", "请先启动料仓!"));
}
}
catch (Exception ex)
......@@ -605,7 +606,7 @@ namespace OnlineStore.DUOStore
}
else
{
MessageBox.Show("请先启动料仓!");
MessageBox.Show(crc.GetString("start_store_first", "请先启动料仓!"));
}
}
......@@ -686,7 +687,7 @@ namespace OnlineStore.DUOStore
{
if (!BoxBean.IsDebug)
{
DialogResult result = MessageBox.Show("是否切换到调试状态?", "是否确认切换", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
DialogResult result = MessageBox.Show(crc.GetString("switch_to_debug_msg","是否切换到调试状态?"), crc.GetString("switch_to_debug_title","是否确认切换"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.Yes))
{
BoxBean.IsDebug = true;
......@@ -701,7 +702,7 @@ namespace OnlineStore.DUOStore
{
if (BoxBean.IsDebug)
{
DialogResult result = MessageBox.Show("是否切换到正常工作状态?", "是否确认切换", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
DialogResult result = MessageBox.Show(crc.GetString("switch_to_normal_msg","是否切换到正常工作状态?"), crc.GetString("switch_to_debug_title", "是否确认切换"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.Yes))
{
BoxBean.IsDebug = false;
......@@ -747,7 +748,7 @@ namespace OnlineStore.DUOStore
foreach (ConfigIO ioValue in BoxBean.Config.DIList.Values)
{
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
this.tableLayoutPanel1.Controls.Add(control, 0, roleindex);
roleindex++;
DIControlList.Add(ioValue.ProName, control);
......@@ -759,7 +760,7 @@ namespace OnlineStore.DUOStore
foreach (ConfigIO ioValue in BoxBean.Config.DOList.Values)
{
this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
this.tableLayoutPanel2.Controls.Add(control, 0, roleindex);
roleindex++;
DOControlList.Add(ioValue.ProName, control);
......@@ -815,7 +816,7 @@ namespace OnlineStore.DUOStore
}
else
{
MessageBox.Show("请先启动料仓!");
MessageBox.Show(crc.GetString("start_store_first", "请先启动料仓!"));
}
}
......@@ -830,7 +831,7 @@ namespace OnlineStore.DUOStore
}
else
{
MessageBox.Show("请先启动料仓!");
MessageBox.Show(crc.GetString("start_store_first", "请先启动料仓!"));
}
}
......
......@@ -348,6 +348,7 @@
this.groupBox4.Size = new System.Drawing.Size(255, 614);
this.groupBox4.TabIndex = 104;
this.groupBox4.TabStop = false;
this.groupBox4.Tag = "nochiled";
this.groupBox4.Text = "DO列表";
//
// tableLayoutPanel2
......@@ -376,6 +377,7 @@
this.groupBox3.Size = new System.Drawing.Size(255, 614);
this.groupBox3.TabIndex = 103;
this.groupBox3.TabStop = false;
this.groupBox3.Tag = "nochiled";
this.groupBox3.Text = "DI列表";
//
// tableLayoutPanel1
......
......@@ -20,6 +20,7 @@ using System.Threading.Tasks;
namespace OnlineStore.DUOStore
{
using crc = CodeResourceControl;
public partial class FrmIOStatus : FrmBase
{
private int StoreId = 1;
......@@ -47,7 +48,7 @@ namespace OnlineStore.DUOStore
//if (ioValue.SubType.Equals(0))
{
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 26));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
this.tableLayoutPanel1.Controls.Add(control, 0, roleindex);
roleindex++;
......@@ -63,7 +64,7 @@ namespace OnlineStore.DUOStore
//if (ioValue.SubType.Equals(0))
{
this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
control.Click += Control_Click;
this.tableLayoutPanel2.Controls.Add(control, 0, roleindex);
roleindex++;
......@@ -338,13 +339,13 @@ namespace OnlineStore.DUOStore
private void btnLineRun_Click(object sender, EventArgs e)
{
StoreManager.Store.LineRun(null);
StoreManager.Store.LineRun(null,"手动运行");
}
private void btnLineStop_Click(object sender, EventArgs e)
{
StoreManager.Store.LineStop(null);
StoreManager.Store.LineStop(null,"手动停止");
}
private void groupBox1_Enter(object sender, EventArgs e)
......
......@@ -26,6 +26,7 @@ namespace OnlineStore.DUOStore
private void FrmPwd_Load(object sender, EventArgs e)
{
this.DialogResult = DialogResult.None;
CodeResourceControl.LanguageProcess(this, this.GetType().Name);
}
private void btnNext_Click(object sender, EventArgs e)
......
......@@ -66,13 +66,15 @@
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.版本号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.语言ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.中文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.英语ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.显示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button1 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.panel1.SuspendLayout();
......@@ -114,7 +116,6 @@
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.chbInstoreEnd);
this.panel1.Controls.Add(this.chkDebug);
this.panel1.Controls.Add(this.lblMoveInfo);
......@@ -271,6 +272,7 @@
this.logBox.Name = "logBox";
this.logBox.Size = new System.Drawing.Size(1098, 500);
this.logBox.TabIndex = 106;
this.logBox.Tag = "not";
this.logBox.Text = "";
this.logBox.VisibleChanged += new System.EventHandler(this.logBox_VisibleChanged);
//
......@@ -294,7 +296,8 @@
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.操作ToolStripMenuItem,
this.设置TToolStripMenuItem,
this.帮助ToolStripMenuItem});
this.帮助ToolStripMenuItem,
this.语言ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1308, 29);
......@@ -387,38 +390,38 @@
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(160, 26);
this.toolStripMenuItem2.Size = new System.Drawing.Size(192, 26);
this.toolStripMenuItem2.Text = "启用调试";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(157, 6);
this.toolStripSeparator6.Size = new System.Drawing.Size(189, 6);
//
// 二维码学习ToolStripMenuItem
//
this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
this.二维码学习ToolStripMenuItem.Text = "二维码学习";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
this.二维码学习ToolStripMenuItem.Text = "二维码识别测试";
this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(157, 6);
this.toolStripSeparator7.Size = new System.Drawing.Size(189, 6);
//
// 扫码测试ToolStripMenuItem
//
this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem";
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
this.扫码测试ToolStripMenuItem.Text = "扫码测试";
this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(157, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(189, 6);
//
// 帮助ToolStripMenuItem
//
......@@ -435,6 +438,31 @@
this.版本号ToolStripMenuItem.Text = "关于软件";
this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click);
//
// 语言ToolStripMenuItem
//
this.语言ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.中文ToolStripMenuItem,
this.英语ToolStripMenuItem});
this.语言ToolStripMenuItem.Name = "语言ToolStripMenuItem";
this.语言ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
this.语言ToolStripMenuItem.Text = "语言";
//
// 中文ToolStripMenuItem
//
this.中文ToolStripMenuItem.Name = "中文ToolStripMenuItem";
this.中文ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.中文ToolStripMenuItem.Tag = "not";
this.中文ToolStripMenuItem.Text = "中文";
this.中文ToolStripMenuItem.Click += new System.EventHandler(this.中文ToolStripMenuItem_Click);
//
// 英语ToolStripMenuItem
//
this.英语ToolStripMenuItem.Name = "英语ToolStripMenuItem";
this.英语ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.英语ToolStripMenuItem.Tag = "not";
this.英语ToolStripMenuItem.Text = "English";
this.英语ToolStripMenuItem.Click += new System.EventHandler(this.英语ToolStripMenuItem_Click);
//
// notifyIcon1
//
this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
......@@ -477,19 +505,6 @@
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.BackColor = System.Drawing.Color.White;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Location = new System.Drawing.Point(12, 490);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(105, 35);
this.button1.TabIndex = 272;
this.button1.Text = "测试";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// FrmStore
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -566,7 +581,9 @@
private System.Windows.Forms.Label lblMoveInfo;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.CheckBox chbInstoreEnd;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ToolStripMenuItem 语言ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 中文ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 英语ToolStripMenuItem;
}
}
......@@ -20,6 +20,7 @@ using UserFromControl;
namespace OnlineStore.DUOStore
{
using crc = CodeResourceControl;
internal partial class FrmStore : Form
{
public static DUOStoreBean store = null;
......@@ -34,8 +35,23 @@ namespace OnlineStore.DUOStore
startTimer.Enabled = false;
startTimer.AutoReset = false;
Control.CheckForIllegalCrossThreadCalls = false;
this.Shown += FrmStore_Shown;
CodeResourceControl.GetLanguageEvent += CodeResourceControl_GetLanguageEvent;
}
private string CodeResourceControl_GetLanguageEvent()
{
return ConfigAppSettings.GetValue("Default_Language");
}
private void FrmStore_Shown(object sender, EventArgs e)
{
//return;
crc.LanguageProcess(this, this.GetType().Name);
crc.ProcessListItem<ToolStripItemCollection>(contextMenuStrip1.Items, "contextMenuStrip1");
crc.ProcessListItem<ToolStripItemCollection>(menuStrip1.Items, "toolStripMenuItem1");
}
private void FrmMain_Load(object sender, EventArgs e)
{
......@@ -52,10 +68,10 @@ namespace OnlineStore.DUOStore
{
FrmBox frm = new FrmBox();
frm.BoxBean = box;
AddForm(box.Name, frm);
AddForm(box.Name, frm, box.Name.Trim());
}
AddForm(" 取料提升机构 ", new FrmAxisMove());
AddForm(" IO状态查看 ", new FrmIOStatus());
AddForm(" 取料提升机构 ", new FrmAxisMove(),"store");
AddForm(" IO状态查看 ", new FrmIOStatus(),"io");
chbAutoRun.Checked = store.UseBuzzer;
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
......@@ -64,6 +80,9 @@ namespace OnlineStore.DUOStore
chbInstoreEnd.Checked = store.InstoreEndSendShelf;
chbOutstoreEnd.Checked = store.OutstoreEndSendShelf;
LoadOk = true;
logBox.Visible = false;
btnClearLog.Visible = false;
btnCopyLog.Visible = false;
LogUtil.logBox = this.logBox;
this.timer1.Start();
}
......@@ -74,10 +93,11 @@ namespace OnlineStore.DUOStore
}
}
private void AddForm(string text, Form form)
private void AddForm(string text, Form form,string name)
{
text = text.PadLeft(12, ' ');
TabPage lineTabPage = new TabPage(text);
lineTabPage.Name = name;
lineTabPage.AutoScroll = true;
// lineTabPage.Tag = lineBean;
Panel linePan = new Panel();
......@@ -99,11 +119,11 @@ namespace OnlineStore.DUOStore
private void LoadListView()
{
this.listView1.Columns.Clear();
AddHealder("名称", 90);
AddHealder("启用", 50);
AddHealder("报警", 130);
AddHealder("状态", 110);
AddHealder("料盘信息", listView1.Size.Width - 110 - 130 - 50 - 90 - 10);
AddHealder(crc.GetString("table_name","名称"), 90);
AddHealder(crc.GetString("table_enable","启用"), 50);
AddHealder(crc.GetString("table_alarm","报警"), 130);
AddHealder(crc.GetString("table_state","状态"), 110);
AddHealder(crc.GetString("table_reelinfo","料盘信息"), listView1.Size.Width - 110 - 130 - 50 - 90 - 10);
//AddHealder("BOX状态", listView1.Size.Width - 100 - 80 - 80 - 100 - 100 - 100 -40- 8);
AddRow(store, false );
......@@ -247,7 +267,7 @@ namespace OnlineStore.DUOStore
private void ExitApp()
{
DialogResult result = MessageBox.Show("是否确定退出DUO料仓客户端?", "提示", MessageBoxButtons.YesNo);
DialogResult result = MessageBox.Show(crc.GetString("confirm_exit_app_msg","是否确定退出DUO料仓客户端?"), crc.GetString("confirm_exit_app_title", "提示"), MessageBoxButtons.YesNo);
if (result.Equals(DialogResult.Yes))
{
//如果料仓还在运行状态,先关闭料仓
......@@ -308,7 +328,7 @@ namespace OnlineStore.DUOStore
{
if (store.runStatus != StoreRunStatus.Wait)
{
MessageBox.Show(store.Name + "当前状态:" + store.runStatus + ",不能启动!");
MessageBox.Show(store.Name + crc.GetString("current_state_is_cant_start", "当前状态:{0},不能启动!", store.runStatus));
return;
}
LogUtil.info( "开始启动");
......@@ -374,7 +394,7 @@ namespace OnlineStore.DUOStore
{
if (store.runStatus.Equals(StoreRunStatus.Wait))
{
MessageBox.Show(store.Name + "DUO料仓未启动,不需要停止");
MessageBox.Show(store.Name + crc.GetString("duostore_is_not_running_cant_stop", "DUO料仓未启动,不需要停止"));
return;
}
if (store != null)
......@@ -389,7 +409,7 @@ namespace OnlineStore.DUOStore
{
if (store.runStatus.Equals(StoreRunStatus.Wait))
{
MessageBox.Show(store.Name + "DUO料仓未启动,无法复位");
MessageBox.Show(store.Name + crc.GetString("duostore_is_not_running_cant_reset","DUO料仓未启动,无法复位"));
return;
}
store.Reset();
......@@ -463,18 +483,18 @@ namespace OnlineStore.DUOStore
string type = "";
if (store.CurrShelfType.Equals(0))
{
type = "空料架";
type = crc.GetString("empty_shelf","空料架");
}
else if (store.CurrShelfType.Equals(1))
{
type = "入库料架";
type = crc.GetString("instore_shelf", "入库料架");
}
else if (store.CurrShelfType.Equals(2))
{
type = "出库料架";
type = crc.GetString("outstore_shelf", "出库料架");
}
lblShelf.Text = "当前" + type + ":" + store.CurrShelfNum;
lblShelf.Text = crc.GetString("current_shelf","当前") + type + ":" + store.CurrShelfNum;
string msg = "";
foreach(BoxBean box in store.BoxMap.Values)
{
......@@ -484,6 +504,8 @@ namespace OnlineStore.DUOStore
msg += box.Name+":"+s+ "\r" ;
}
}
if (!string.IsNullOrWhiteSpace(store.WarnMsg))
msg += store.Name + ":" + store.WarnMsg + "\r";
UpdateListBox();
lblWarnMsg.Text = msg;
LogM();
......@@ -536,6 +558,7 @@ namespace OnlineStore.DUOStore
{
FrmAbout about = new FrmAbout();
about.ShowDialog();
crc.LanguageProcess(about, about.GetType().Name);
}
private void 二维码学习ToolStripMenuItem_Click(object sender, EventArgs e)
......@@ -545,7 +568,8 @@ namespace OnlineStore.DUOStore
Camera._cam.CloseAll();
}
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
frm.ShowDialog();
frm.Show();
crc.LanguageProcess(frm, frm.GetType().Name);
}
......@@ -561,7 +585,7 @@ namespace OnlineStore.DUOStore
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
if (toolStripMenuItem2.Text .Equals("启用调试"))
if (toolStripMenuItem2.Text.Equals(crc.GetString("设置TToolStripMenuItem_toolStripMenuItem2_Text", "启用调试")))
{
DebugOpen(true );
}
......@@ -603,11 +627,11 @@ namespace OnlineStore.DUOStore
if (isopen)
{
toolStripMenuItem2.Text = "禁用调试";
toolStripMenuItem2.Text = crc.GetString("menu_disable_debug", "启用调试");
}
else
{
toolStripMenuItem2.Text = "启用调试";
toolStripMenuItem2.Text = crc.GetString("设置TToolStripMenuItem_toolStripMenuItem2_Text", "启用调试");
}
}
......@@ -669,13 +693,13 @@ namespace OnlineStore.DUOStore
{
result += s + "\r\n";
}
MessageBox.Show("扫到二维码:" + result);
MessageBox.Show(crc.GetString("has_scan_qecode","扫到二维码")+":" + result);
LogUtil.info("扫到二维码:" + result);
}
else
{
MessageBox.Show("未扫到二维码");
MessageBox.Show(crc.GetString("hasnot_scan_qecode", "未扫到二维码"));
}
}
......@@ -710,12 +734,6 @@ namespace OnlineStore.DUOStore
}
private async void button1_Click(object sender, EventArgs e)
{
int contentLength = await AccessTheWebAsync();
this.logBox.Text+= $"\r\nLength of the downloaded string: {contentLength}.\r\n";
}
async Task<int> AccessTheWebAsync()
{
// You need to add a reference to System.Net.Http to declare client.
......@@ -745,5 +763,17 @@ namespace OnlineStore.DUOStore
Console.WriteLine("Working ... .... ");
this.logBox.Text += $"\r\nWorking ... .... .\r\n";
}
private void 英语ToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigAppSettings.SaveValue("Default_Language", "en-US");
FrmStore_Shown(this, EventArgs.Empty);
}
private void 中文ToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigAppSettings.SaveValue("Default_Language", "zh-CN");
FrmStore_Shown(this, EventArgs.Empty);
}
}
}
......@@ -14,6 +14,8 @@ namespace OnlineStore.DUOStore
{
static class Program
{
#region 方法四:使用的Win32函数的声明
/// <summary>
......@@ -56,6 +58,8 @@ namespace OnlineStore.DUOStore
//string path = @"http://localhost:4090/rest/api/v1/station/status";
//HttpHelper.PostOperation(path, new Operation());
//var a = DeviceLibrary.InOutParam.GetPosStoreId("4#AC3_17_3_22");
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
......@@ -94,6 +98,9 @@ namespace OnlineStore.DUOStore
}
}
}
Environment.CurrentDirectory = Application.StartupPath;
CodeResourceControl.OpenResourceLog = true;
CodeResourceControl.CurrLanguage = CodeResourceControl.China;
if (!isShow)
{
XmlConfigurator.Configure();
......
......@@ -74,6 +74,7 @@
<Compile Include="duoStore\BoxBean.cs" />
<Compile Include="duoStore\BoxBean_Partial.cs" />
<Compile Include="duoStore\BoxBean_Shelf.cs" />
<Compile Include="duoStore\DUOStoreBean_LineRunMonitor.cs" />
<Compile Include="duoStore\DUOStoreBean_Partial.cs" />
<Compile Include="duoStore\EquipBase.cs" />
<Compile Include="duoStore\HoisterCylinder.cs" />
......
......@@ -59,8 +59,8 @@ DI,2,右侧出料口安全光栅,OutDoor_SafeSignal,10,PRO_AIO_IP_2,X31,,,,,,,,,,
DI,2,右侧暂存区料盘检测,InDoor_Check,11,PRO_AIO_IP_2,X32,,,,,,,,,,
DI,2,右侧出料口门上升/打开端,OutDoor_Up,12,PRO_AIO_IP_2,X33,,,,,,,,,,
DI,2,右侧出料口门下降/关闭端,OutDoor_Down,13,PRO_AIO_IP_2,X34,,,,,,,,,,
DI,2,右侧料叉料盘检测,OutDoor_Check,15,PRO_AIO_IP_2,X35,,,,,,,,,,
DI,2,右侧出料口料盘检测,Fixture_Check,14,PRO_AIO_IP_2,X36,,,,,,,,,,
DI,2,右侧料叉料盘检测,Fixture_Check,14,PRO_AIO_IP_2,X35,,,,,,,,,,
DI,2,右侧出料口料盘检测,OutDoor_Check,15,PRO_AIO_IP_2,X36,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,2,右侧料仓伺服ON,Axis_Run,0,PRO_AIO_IP_2,Y21,,,,,,,,,,
DO,0,取料机构伺服ON,MoveAxis_Run,1,PRO_AIO_IP_2,Y22,,,,,,,,,,
......@@ -139,5 +139,5 @@ PRO,,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,0,是否调试状态(1=调试,0=正常),IsDebug,1,,,,,,,,,,,,
PRO,,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,,,,,,
PRO,,所有料仓的CID(用#号分隔),All_CIDs,duo-1,duo-2,,,,,,,,,,,,
PRO,,所有料仓的CID(用#号分隔),All_CIDs,duo-1,duo-2,,,,,,,,,,,
PRO,,扫码的相机名称(多个用#分隔),CameraNameList,GigE:MV-CE200-10GC (00E45255378)#,,,,,,,,,,,,
......@@ -17,16 +17,34 @@ namespace OnlineStore.DeviceLibrary
public static List<string> codeTypeList = new List<string>();
//public static List<string> balserNameList = new List<string>();
public static List<string> hikNameList = new List<string>();
public static List<int> Code_Block_Size_List = new List<int>();
private static char spiltChar = '#';
/// <summary>
/// 初始化摄像机名称和二维码类型
/// </summary>
public static void LoadConfig()
{
HDLogUtil.LogName = "RollingLogFileAppender";
string code_block_size_list = ConfigAppSettings.GetValue(Setting_Init.code_block_size_list);
var cl = code_block_size_list.Split(',');
foreach (string s in cl)
{
int i;
if (int.TryParse(s, out i))
{
Code_Block_Size_List.Add(i);
}
}
if (Code_Block_Size_List.Count == 0)
Code_Block_Size_List.Add(19);
LogUtil.info("加载到配置二维码块尺寸:" + string.Join(",", Code_Block_Size_List));
string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType);
codeTypeList = new List<string>();
HDLogUtil.LogName = "RollingLogFileAppender";
try
{
string[] codeArray = codeStr.Split(spiltChar);
......@@ -141,12 +159,16 @@ namespace OnlineStore.DeviceLibrary
List<CodeInfo> cc = new List<CodeInfo>();
string r = "";
foreach (int codesize in Code_Block_Size_List)
{
//if (codeList.Count > 0)
// break;
List<CodeInfo> tlci = EyemDecode.Decoder(ref bmp,null,15);
List<CodeInfo> tlci = EyemDecode.Decoder(ref bmp, null, codesize);
foreach (CodeInfo code in tlci)
{
LogUtil.info(" 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
LogUtil.info(" 【" + cameraName + $"】[eyemDecode blocksize:{codesize}]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
string str = CodeManager.ReplaceCode(code.CodeStr);
lock (codeList)
{
......@@ -157,7 +179,8 @@ namespace OnlineStore.DeviceLibrary
}
}
}
/*
}
foreach (string codeType in codeTypeList)
{
//判断是否是一维码
......@@ -179,7 +202,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
*/
if (String.IsNullOrEmpty(r))
{
SaveImageToFile(deviceName, cameraName, bmp);
......
......@@ -14,6 +14,7 @@ using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
using crc = CodeResourceControl;
public partial class BoxBean : EquipBase
{
public AutoInoutInfo AutoInout = new AutoInoutInfo();
......@@ -45,6 +46,8 @@ namespace OnlineStore.DeviceLibrary
IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
serverConTimer.Elapsed += server_connect_timer_Tick;
GC.KeepAlive(IoCheckTimer);
GC.KeepAlive(serverConTimer);
logType = 1000 * config.Id;
//添加调试
IsDebug = config.IsInDebug.Equals(1);
......@@ -84,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
{
isInSuddenDown = true;
LogUtil.error(Name + "收到急停信号,报警急停");
WarnMsg = Name + "收到急停信号,报警急停";
WarnMsg = crc.GetString("scrambtn_open_alarm", "{0}收到急停信号,报警急停", Name);
//报警时会关闭所有轴
Alarm(AlarmType.SuddenStop, "1", WarnMsg, MoveType.None);
......@@ -107,13 +110,13 @@ namespace OnlineStore.DeviceLibrary
{
if (!StoreManager.Store.canStart)
{
WarnMsg = "启动失败:设备未初始化完成";
WarnMsg = crc.GetString("start_fail_device_init_unfinished", "启动失败:设备未初始化完成");
LogUtil.error(Name + "启动失败:设备未初始化完成");
return false;
}
if (Disabled)
{
WarnMsg = "启动失败:设备被禁用";
WarnMsg = crc.GetString("start_fail_device_disable", "启动失败:设备被禁用");
LogUtil.error(Name + "启动失败:设备被禁用");
return false;
}
......@@ -124,13 +127,13 @@ namespace OnlineStore.DeviceLibrary
if (IOManager.IOValue(IO_Type.SuddenStop_BTN, 0).Equals(IO_VALUE.LOW))
{
WarnMsg = "启动失败:急停没开";
WarnMsg = crc.GetString("start_fail_scrambtn_close", "启动失败:急停未开");
LogUtil.error(" (" + Name + ")启动失败:急停没开!");
return false;
}
else if (IOManager.IOValue(IO_Type.Airpressure_Check, 0).Equals(IO_VALUE.LOW))
{
WarnMsg = "启动失败:没有气压信号";
WarnMsg = crc.GetString("start_fail_air_notdetect", "启动失败:没有气压信号");
LogUtil.error(" (" + Name + ")启动失败:没有气压信号!");
return false;
}
......@@ -238,11 +241,11 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(Name + MoveInfo.MoveType + "复位失败: " + Config.InOut_Axis.Explain + "报警");
WarnMsg = Name + "复位失败: " + Config.InOut_Axis.Explain + "报警";
Alarm(AlarmType.AxisAlarm );
Alarm(AlarmType.AxisAlarm);
return;
}
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H03_OtherAxisHome);
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H03_OtherAxisHome_wait);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
LogInfo(MoveInfo.MoveType + ": 压紧轴,旋转轴,上下轴开始 原点返回,关闭NG门");
CylinderMove(MoveInfo, IO_Type.OutDoor_Up, IO_Type.OutDoor_Down);
......@@ -251,6 +254,47 @@ namespace OnlineStore.DeviceLibrary
UpdownAxis.HomeMove(MoveInfo);
break;
case StoreMoveStep.BOX_H03_OtherAxisHome_wait:
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H03_SendOut_01);
if (IOValue(IO_Type.OutDoor_Check).Equals(IO_VALUE.HIGH))
{
CylinderMove(MoveInfo, IO_Type.OutDoor_Down, IO_Type.OutDoor_Up);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.OutDoor_Check, IO_VALUE.LOW));
}
break;
case StoreMoveStep.BOX_H03_SendOut_01:
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H03_SendOut_02);
InOutStoreLog("复位:" + "移动到出料口,旋转轴到P11[" + Config.MiddleAxis_P11 + "],升降轴到P12高点[" + Config.UpDownAxis_P12 + "] ");
MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P11, Config.MiddleAxis_P11_Speed);
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxis_P12, Config.UpDownAxis_P12_Speed);
break;
case StoreMoveStep.BOX_H03_SendOut_02:
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H03_SendOut_03);
InOutStoreLog("复位:" + "进出轴到_P11-出料口取放料点 [" + Config.InOutAxis_P11 + "] ");
InoutAxis.AbsMove(MoveInfo, Config.InOutAxis_P11, Config.InOutAxis_P11_Speed);
break;
case StoreMoveStep.BOX_H03_SendOut_03:
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H03_SendOut_04);
InOutStoreLog("复位:" + "升降轴到_P11-出料口-低点[" + Config.UpDownAxis_P11 + "]");
//ComAxis.AbsMove(MoveInfo, Config.CompAxis_P1, Config.CompAxis_P3_Speed);
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxis_P11, Config.UpDownAxis_P11_Speed);
break;
case StoreMoveStep.BOX_H03_SendOut_04:
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H03_SendOut_05);
InOutStoreLog("复位:" + "进出轴返回P1 [" + Config.InOutAxis_P1 + "], 打开出料口门 ");
InOutBackToP1(Config.InOutAxis_P1);
OutDoorReelType = 2;
CylinderMove(MoveInfo, IO_Type.OutDoor_Down, IO_Type.OutDoor_Up);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.OutDoor_Check, IO_VALUE.LOW));
break;
case StoreMoveStep.BOX_H03_SendOut_05:
if (IOValue(IO_Type.OutDoor_SafeSignal).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H03_OtherAxisHome);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
break;
case StoreMoveStep.BOX_H03_OtherAxisHome:
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H04_OtherAxisBack);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
......@@ -258,10 +302,41 @@ namespace OnlineStore.DeviceLibrary
MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P1, Config.MiddleAxis_P1_Speed);
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxis_P1, Config.UpDownAxis_P1_Speed);
ComAxis.AbsMove(MoveInfo, Config.CompAxis_P1, Config.CompAxis_P1_Speed);
CylinderMove(MoveInfo, IO_Type.OutDoor_Up, IO_Type.OutDoor_Down);
break;
case StoreMoveStep.BOX_H04_OtherAxisBack:
LogInfo(MoveInfo.MoveType + ": 完成");
MoveEndP();
if (AutoInout.autoNext && waitOutStoreList.Count>0)
{
LogInfo("自动出库还在进行");
InOutParam param;
bool result = waitOutStoreList.TryDequeue(out param);
if (result && param != null)
{
LogInfo("执行排队的出库【" + param.ToStr() + "】");
StartOutStoreMove(param);
}
else {
LogInfo("没有排队的出库信息");
}
}
else if (IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.HIGH) && IsDebug.Equals(false))
{
LogInfo("发现入口有无信息料");
InOutParam inOutParam = new InOutParam(MoveType.InStore);
inOutParam.InStoreNg = true;
inOutParam.TargetPosition = 1;
inOutParam.moveType = MoveType.InStore;
inOutParam.PlateH = 56;
StoreManager.LoadInoutParam(inOutParam, MoveType.InStore, true, this);
runStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
MoveInfo.NewMove(MoveType.InStore, inOutParam);
MoveInfo.NextMoveStep(StoreMoveStep.SI_01_InoutToP1);
}
break;
default: break;
}
......@@ -326,12 +401,23 @@ namespace OnlineStore.DeviceLibrary
}
}
string lastOutPosID = "";
private void AutoResetProcess()
{
try
{
bool noInStore = MoveInfo.MoveType.Equals(MoveType.None) && alarmType.Equals(AlarmType.None);
if (noInStore)
{
if (Config.Id == 1)
{
noInStore = StoreManager.Store.T3_UpdownAxis.GetAclPosition() < (StoreManager.Store.Config.UpdownAxis_P3 - StoreManager.Store.Config.UpdownAxis_P4) / 1.5;
}
else
{
noInStore = StoreManager.Store.T3_UpdownAxis.GetAclPosition() < (StoreManager.Store.Config.UpdownAxis_P5 - StoreManager.Store.Config.UpdownAxis_P6) / 1.5;
}
}
//LogInfo($"判断是否需要出入库noInStore={noInStore},MoveInfo.MoveType={MoveInfo.MoveType},InDoor_Check={IOValue(IO_Type.InDoor_Check)},waitInStoreParam={waitInStoreParam},IsDebug={IsDebug}");
if (AutoInout.CurrInOutACount >= StoreManager.Config.Box_ResetACount && noInStore)
{
......@@ -403,13 +489,17 @@ namespace OnlineStore.DeviceLibrary
//waitInStoreParam = null;
}
}
else if (waitOutStoreList.Count > 0 && noInStore && IsDebug.Equals(false))
else if (waitOutStoreList.Count > 0 && noInStore && (IsDebug.Equals(false) || AutoInout.autoNext))
{
InOutParam param = null;
bool result = waitOutStoreList.TryDequeue(out param);
if (result && param != null)
{
if (lastOutPosID != param.PosID)
{
LogInfo("执行排队的出库【" + param.ToStr() + "】");
}
LogUtil.OutputDebugString(Name + "执行排队的出库【" + param.ToStr() + "】");
StartExecuctOut(param);
}
}
......
......@@ -84,19 +84,38 @@ namespace OnlineStore.DeviceLibrary
return false;
}
bool GetOut = false;
if (!StoreManager.LoadInoutParam(param, MoveType.InStore, true, this))
{
LogUtil.error(Name + " 启动入库【" + param.ToStr() + "】出错,找不到库位信息");
return false;
GetOut = true;
}
LogInfo(" 启动入库【" + param.ToStr() + "】 ");
if (!AutoInout.autoNext)
LogInfo("LoadInoutParam" + JsonHelper.SerializeObject(param.MoveP));
if (AutoInout.autoNext || param.WareCode == "#test#")
{
if (!param.InStoreNg && !ReviceInStoreCMD(param.PosID, param.PlateH, param.PlateW, param.WareCode))
return false;
LogInfo(" 循环测试入库, 不做入库验证. ");
}
else
{
if (param.InStoreNg)
{
LogInfo(" NG料送出. ");
GetOut = true;
}
//else if (!ReviceInStoreCMD(param.PosID, param.PlateH, param.PlateW, param.WareCode))
//{
// LogInfo(" 入库验证失败送出. ");
// GetOut = true;
//}
}
if (GetOut)
{
param.TargetPosition = 1;
param.InStoreNg = true;
param.MoveP = null;
StoreManager.LoadInoutParam(param, MoveType.InStore, true, this);
}
runStatus = StoreRunStatus.Busy;
if (param.TargetPosition.Equals(0))
{
......@@ -217,7 +236,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.SI_09_InoutToP1);
InOutStoreLog(outType + "进出轴返回P1 [" + moveP.InOut_P1 + "] ");
InOutBackToP1(moveP.InOut_P1);
OutDoorReelType = 2;
}
else if (MoveInfo.IsStep( StoreMoveStep.SI_09_InoutToP1))
{
......@@ -312,7 +331,7 @@ namespace OnlineStore.DeviceLibrary
private void StartExecuctOut(InOutParam param)
{
bool result = false;
if (StoreManager.Store.CanOut(true))
if (StoreManager.Store.CanOut(true) || param.TargetPosition == 1)
{
result = StartOutStoreMove(param);
}
......@@ -321,7 +340,12 @@ namespace OnlineStore.DeviceLibrary
{
lock (waitOutStoreList)
{
if (lastOutPosID != param.PosID)
{
LogInfo(" 执行出库【" + param.ToStr() + "】失败,加入等待队列");
lastOutPosID = param.PosID;
}
LogUtil.OutputDebugString(Name + " 执行出库【" + param.ToStr() + "】失败,加入等待队列");
if (MoveInfo.MoveType.Equals(MoveType.OutStore) && MoveInfo.MoveParam.PosID.Equals(param.PosID))
{
LogUtil.error(Name + " 出库命令【" + param.ToStr() + "】重复,正在【" + MoveInfo.MoveParam.PosID + "】出库中");
......@@ -338,16 +362,17 @@ namespace OnlineStore.DeviceLibrary
}
}
public override bool StartOutStoreMove(InOutParam param)
public override bool StartOutStoreMove(InOutParam param, bool shelfisready = false)
{
startOutStoreTime = DateTime.Now;
string posId = param != null ? param.PosID : "";
if (isInSuddenDown || isNoAirCheck ||
(!runStatus.Equals(StoreRunStatus.Runing))
|| (!MoveInfo.MoveType.Equals(MoveType.None)))
if (isInSuddenDown || isNoAirCheck
|| !runStatus.Equals(StoreRunStatus.Runing)
|| !MoveInfo.MoveType.Equals(MoveType.None)
|| (IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.HIGH) && param.TargetPosition != 1))
{
LogUtil.error(Name + " 启动出库【" + param.ToStr() + "】失败,忙碌或报警中 ,storeStatus:" + runStatus + ",MoveType:" + MoveInfo.MoveType + ",isInSuddenDown:" + isInSuddenDown + ",isNoAirCheck:" + isNoAirCheck);
LogUtil.error(Name + " 启动出库【" + param.ToStr() + "】失败,忙碌或报警中 ,storeStatus:" + runStatus + ",MoveType:" + MoveInfo.MoveType + ",isInSuddenDown:" + isInSuddenDown + ",isNoAirCheck:" + isNoAirCheck + ",IO_Type.InDoor_Check;" + IOValue(IO_Type.InDoor_Check));
return false;
}
......@@ -362,6 +387,7 @@ namespace OnlineStore.DeviceLibrary
param.moveType = MoveType.OutStore;
MoveInfo.NewMove(MoveType.OutStore, param);
LogInfo("启动出库【" + param.ToStr() + "】 ");
LogInfo("LoadInoutParam" + JsonHelper.SerializeObject(param.MoveP));
//出库前shelfPosID需要固定,出库时根据rfid判断是否需要出入料架
MoveInfo.NextMoveStep(StoreMoveStep.SO_01_InoutBack);
InOutStoreLog("出库 :进出轴到P1 开始");
......@@ -505,6 +531,11 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.InDoor_Check, IO_VALUE.LOW));
MoveInfo.OneWaitCanEndStep = true;
}
else if (MoveInfo.MoveParam.WareCode== "#test#")
{
InOutStoreLog(outType + "检测到为测试料,运行结束");
MoveEndP();
}
else
{
if (StoreManager.Store.MoveInfo.MoveType.Equals(MoveType.OutStore) && StoreManager.Store.MoveInfo.MoveStep.Equals(StoreMoveStep.LO_09_WaitOut))
......@@ -513,23 +544,28 @@ namespace OnlineStore.DeviceLibrary
if (result)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_12_WaitTrayGo);
InOutStoreLog(outType + "等待提升机构拿走料盘 ");
InOutStoreLog(outType + $"等待提升机构拿走料盘 {MoveInfo.MoveParam.WareCode}");
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.InDoor_Check, IO_VALUE.LOW));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.InDoor_Check, IO_VALUE.LOW));
ClearTimeoutAlarm("提升机构夹爪开始取料");
ClearTimeoutAlarm("提升机构夹爪可以取料");
}
else if (MoveInfo.IsTimeOut(60))
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 等待 提升机构夹爪开始取料 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + $"] 等待 提升机构夹爪开始取料({MoveInfo.MoveParam.WareCode}) 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, ID * 1000 + 30);
Alarm(AlarmType.IoSingleTimeOut);
}
}
else if (MoveInfo.IsTimeOut(60))
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 等待 提升机构夹爪可以取料 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
if (StoreManager.Store.MoveInfo.MoveStep == StoreMoveStep.LI_17_SaveSize)
{
InOutStoreLog(outType + " 线体开始入料, 将当前滞留盘送往紧急出料口");
MoveInfo.NextMoveStep(StoreMoveStep.SO_14_InoutToP1);
}
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 等待 提升机构可以取料 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, ID * 1000 + 30);
Alarm(AlarmType.IoSingleTimeOut);
}
......@@ -537,6 +573,13 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StoreMoveStep.SO_12_WaitTrayGo))
{
if (IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.HIGH) && MoveInfo.IsTimeOut(30) && !AutoInout.autoNext)
{
LogUtil.info(Name + " 等待夹爪取料超时,送至紧急出料口!");
MoveInfo.NextMoveStep(StoreMoveStep.SO_14_InoutToP1);
}
else if (IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.LOW) || AutoInout.autoNext)
{
TimeSpan span = DateTime.Now - startOutStoreTime;
string posId = MoveInfo.MoveParam.PosID;
LogUtil.info(Name + " 【" + posId + "】 出库结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
......@@ -544,11 +587,13 @@ namespace OnlineStore.DeviceLibrary
MoveEndP();
AutoInout.InOutEndProcess(this, MoveType.OutStore);
}
}
#endregion
#region 出料移栽失败,送至紧急出料口
else if (MoveInfo.IsStep(StoreMoveStep.SO_14_InoutToP1))
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_15_AxisBack);
MoveInfo.MoveParam.TargetPosition = 1;
InOutStoreLog(outType + " 升降轴到P1[" + moveP.UpDown_P1 + "],旋转轴到P1[" + moveP.Middle_P1 + "] ,压紧轴到P3[" + moveP.ComPress_P3 + "]");
ComAxis.AbsMove(MoveInfo, moveP.ComPress_P3, Config.CompAxis_P3_Speed);
UpdownAxis.AbsMove(MoveInfo, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
......
......@@ -240,6 +240,9 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(logName + " 成功");
return true;
}
else {
LogUtil.info(logName + "发送:【" + JsonHelper.SerializeObject(operation) + "】,服务器返回:" + JsonHelper.SerializeObject(resultOperation));
}
break;
}
}
......@@ -264,6 +267,7 @@ namespace OnlineStore.DeviceLibrary
string[] plateHArray = data[ParamDefine.plateH].Split(splitChar);
bool urgentReel = FormUtil.GetBoolData(data, ParamDefine.urgentReel);
bool singleOut = FormUtil.GetBoolData(data, ParamDefine.singleOut);
//bool cutReel = FormUtil.GetBoolData(data, ParamDefine.cutReel);
//bool smallReel = FormUtil.GetBoolData(data, ParamDefine.smallReel);
//string rfid = data.ContainsKey(ParamDefine.rfid) ? data[ParamDefine.rfid] : "";
......@@ -287,7 +291,7 @@ namespace OnlineStore.DeviceLibrary
index++;
int plateW =Convert.ToInt32( plateWArray[index]);
int plateH = Convert.ToInt32(plateHArray[index]);
InOutParam inoutParam = new InOutParam(MoveType.OutStore, barcode, posId, plateW, plateH, (urgentReel ? 1 : 0));
InOutParam inoutParam = new InOutParam(MoveType.OutStore, barcode, posId, plateW, plateH, ((urgentReel || singleOut) ? 1 : 0));
//根据发送的posId获取位置列表
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
......
......@@ -15,6 +15,7 @@ using System.Timers;
namespace OnlineStore.DeviceLibrary
{
using crc = CodeResourceControl;
public partial class DUOStoreBean : EquipBase
{
internal Dictionary<int, BOX_Config> BoxConfigMap { get; set; }
......@@ -50,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
this.Config = lineConfig;
this.ID = lineConfig.Id;
Name = (" DUO料仓 ").ToUpper();
Name = crc.GetString("duo_store"," DUO料仓 ").ToUpper();
MoveInfo = new StoreMoveInfo(ID, Name);
List<string> ioList = new List<string>();
AddDeviceName(ioList, Config.IOIPList);
......@@ -84,6 +85,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
mainTimer.Enabled = true;
canStart = true;
int isAuto = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun);
......@@ -114,21 +116,21 @@ namespace OnlineStore.DeviceLibrary
{
if (!canStart)
{
SetWarnMsg("启动失败:设备未初始化完成");
SetWarnMsg(crc.GetString("start_fail_device_init_unfinished","启动失败:设备未初始化完成"));
return false;
}
if (BoxConfigMap == null)
{
SetWarnMsg("启动失败:未加载到料仓配置");
SetWarnMsg(crc.GetString("start_fail_device_load_boxconfig_fail", "启动失败:未加载到料仓配置"));
return false;
}
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
SetWarnMsg("启动失败:急停未开");
SetWarnMsg(crc.GetString("start_fail_scrambtn_close", "启动失败:急停未开"));
}
else if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW))
{
SetWarnMsg("启动失败:没有气压信号");
SetWarnMsg(crc.GetString("start_fail_air_notdetect", "启动失败:没有气压信号"));
}
else
{
......@@ -137,6 +139,7 @@ namespace OnlineStore.DeviceLibrary
return false;
}
LogUtil.info(Name + "开始启动 ,启动时间:" + StartTime.ToString());
IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
runStatus = StoreRunStatus.HomeMoving;
StartTime = DateTime.Now;
StartResetMove();
......@@ -270,7 +273,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
CylinderMove(MoveInfo, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P1, Config.MiddleAxis_P1Speed);
LineRun(MoveInfo);
LineRun(MoveInfo, "LR_06_TopDown");
}
else if (MoveInfo.IsStep(StoreMoveStep.LR_06_TopDown))
{
......@@ -288,7 +291,7 @@ namespace OnlineStore.DeviceLibrary
}
//判断是否所有的已经返回完成
string msg = "等待BOX复位完成超时";
string msg = crc.GetString("wait_box_reset_timeout","等待{0}复位完成超时","box");
foreach (BoxBean box in this.BoxMap.Values)
{
if (box.Disabled)
......@@ -298,13 +301,13 @@ namespace OnlineStore.DeviceLibrary
{
if (box.alarmType.Equals(AlarmType.None))
{
msg = "等待"+ box .Name+ "复位完成超时";
msg = crc.GetString("wait_box_reset_timeout", "等待{0}复位完成超时", box.Name);
isOk = false;
break;
}
else
{
WarnMsg = box.Name + "在复位过程中报警,需要重新复位";
WarnMsg = crc.GetString("after_alarm_need_reset", "{0}在复位过程中报警,需要重新复位", box.Name);
}
}
}
......@@ -340,7 +343,7 @@ namespace OnlineStore.DeviceLibrary
CloseAllAxis();
LineStop();
LineStop("n");
}
......@@ -355,6 +358,7 @@ namespace OnlineStore.DeviceLibrary
equip.StopRun();
}
runStatus = StoreRunStatus.Wait;
IOMove(IO_Type.Device_Led, IO_VALUE.LOW);
// RFIDManager.Close();
TimeSpan span = DateTime.Now - StartTime;
LogUtil.info(Name + ",停止运行,总运行时间:" + span.ToString());
......@@ -445,20 +449,34 @@ namespace OnlineStore.DeviceLibrary
{
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
}
if (IOValue(IO_Type.Line_OutCheck).Equals(IO_VALUE.HIGH))
if (isNeedAlarmLed && StoreManager.Store.UseBuzzer)
{
//IOMove(IO_Type.LineOut_Led, IO_VALUE.HIGH);
IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH);
}
else
{
IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW);
}
if (IOValue(IO_Type.Line_OutCheck).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.Line_BufferCheck).Equals(IO_VALUE.HIGH))
{
IOMove(IO_Type.LineOut_Led, IO_VALUE.HIGH, true);
}
else {
//IOMove(IO_Type.LineOut_Led, IO_VALUE.LOW);
IOMove(IO_Type.LineOut_Led, IO_VALUE.LOW, true);
}
bool hasWaitOut = (BoxMap[1].waitOutStoreList.Count > 0 && BoxMap[1].storeStatus != StoreStatus.SuddenStop) || (BoxMap[2].waitOutStoreList.Count > 0 && BoxMap[2].storeStatus != StoreStatus.SuddenStop);
LogUtil.OutputDebugString($"LedProcess:hasWaitOut:{hasWaitOut}, BoxMap[1]={BoxMap[1].waitOutStoreList.Count},{BoxMap[1].storeStatus},BoxMap[2]={BoxMap[2].waitOutStoreList.Count},{BoxMap[2].storeStatus}");
if (!hasWaitOut) {
hasWaitOut= BoxMap[1].MoveInfo.MoveStep == StoreMoveStep.SO_11_GoBack || BoxMap[2].MoveInfo.MoveStep == StoreMoveStep.SO_11_GoBack;
}
if (IOValue(IO_Type.Line_InCheck).Equals(IO_VALUE.LOW))
LogUtil.OutputDebugString($"LedProcess:hasWaitOut:{hasWaitOut}");
if (hasWaitOut)
{
//IOMove(IO_Type.LineIn_Led, IO_VALUE.HIGH);
IOMove(IO_Type.LineIn_Led, IO_VALUE.HIGH,true);
}
else
{
//IOMove(IO_Type.LineIn_Led, IO_VALUE.LOW);
IOMove(IO_Type.LineIn_Led, IO_VALUE.LOW, true);
}
}
......@@ -493,7 +511,7 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - lastAirCloseTime;
if (span.TotalSeconds > StoreManager.Config.AirCheckSeconds)
{
WarnMsg = "未检测到气压信号";
WarnMsg = crc.GetString("notdetect_air","未检测到气压信号");
preAirValue = IO_VALUE.LOW;
LogUtil.info("已持续【" + FormUtil.GetSpanStr(span) + "】未检测到气压信号,报警");
Alarm(AlarmType.NoAirCheck, "2", WarnMsg, MoveType.None);
......@@ -550,6 +568,15 @@ namespace OnlineStore.DeviceLibrary
//急停按钮
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
if (isInSuddenDown.Equals(false))
{
isInSuddenDown = true;
LogUtil.error(Name + "收到急停信号,报警急停");
WarnMsg = crc.GetString("scrambtn_open_alarm", "{0}收到急停信号,报警急停", Name);
//报警时会关闭所有轴
Alarm(AlarmType.SuddenStop, "1", WarnMsg, MoveType.None);
}
return;
}
else if (IOValue(IO_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
......@@ -570,7 +597,7 @@ namespace OnlineStore.DeviceLibrary
{
//收到复位信号
LogUtil.info("收到复位信号,自动复位");
WarnMsg = "收到复位信号,自动复位";
WarnMsg = crc.GetString("resetbtn_open_auto_reset","收到复位信号,自动复位");
Reset();
}
}
......@@ -630,8 +657,9 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.Line_OutCheck).Equals(IO_VALUE.HIGH))
{
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH, false, 4000);
IOMove(IO_Type.Line_Stop4_Out, IO_VALUE.HIGH, false, 1000);
//IOMove(IO_Type.Line_Run, IO_VALUE.HIGH, false, 4000);
LineRun("LineOut_BTN_Process", 4);
IOMove(IO_Type.Line_Stop4_Out, IO_VALUE.HIGH, false, 2000);
LogUtil.info(Name + "脚踩按钮,放行区放行");
}
......@@ -641,61 +669,67 @@ namespace OnlineStore.DeviceLibrary
&& IOValue(IO_Type.Hoister_Back).Equals(IO_VALUE.HIGH)
)
{
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH, false, 3000);
LineRun("LineOut_BTN_Process", 3);
IOMove(IO_Type.Line_Stop2_Work, IO_VALUE.HIGH, false, 2000);
LogUtil.info(Name + "脚踩按钮,工作区放行");
}
bool box1stay = BoxMap[1].runStatus == StoreRunStatus.Runing || BoxMap[1].runStatus == StoreRunStatus.Wait;
bool box2stay = BoxMap[2].runStatus == StoreRunStatus.Runing || BoxMap[2].runStatus == StoreRunStatus.Wait;
bool shelfstay = StoreManager.Store.MoveInfo.MoveStep.Equals(StoreMoveStep.LO_09_WaitOut);
if (box1stay && box2stay && shelfstay) {
if (box1stay && box2stay && shelfstay)
{
//OutstoreEndSendShelf = true;
LO_31_BatchAxisToP1();
LogUtil.info(Name + "脚踩按钮,出库强制放行");
}
}
private bool LowProcess=false;
private Stopwatch lowWatch = new Stopwatch();
private void ShelfOutProcess()
{
try
{
if (IOValue(IO_Type.Line_OutCheck).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.Line_BackRun).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.Line_Run).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.Line_BufferCheck).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.Line_Stop3_Buffer).Equals(IO_VALUE.LOW) &&
// IOValue(IO_Type.Line_Stop3_Buffer).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.Line_Stop4_Out).Equals(IO_VALUE.LOW) &&
LowProcess.Equals(false))
{
if (StoreManager.checkWatch(lowWatch, 3000))
{
//左侧下层需要放个料架
Task.Factory.StartNew(delegate
{
try
{
if (StoreManager.checkWatch(lowWatch, 3000))
{
LowProcess = true;
LogUtil.info(Name + "从料架堆积处放一个料架到后端");
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH, false, 30000);
IOMove(IO_Type.Line_Stop3_Buffer, IO_VALUE.HIGH, false, 2000);
if (WaitIo(IO_Type.Line_OutCheck, IO_VALUE.HIGH, 30000, "堆积处放料架到后端"))
LineRun("ShelfOutProcess", 10);
IOMove(IO_Type.Line_Stop3_Buffer, IO_VALUE.HIGH, false, 2500);
if (WaitIo(IO_Type.Line_OutCheck, IO_VALUE.HIGH, 10000, "堆积处放料架到后端"))
{
LineStop();
LineStop("ShelfOutProcess");
}
LowProcess = false;
});
}
}
else
catch (Exception ex)
{
lowWatch.Stop();
LogUtil.error(Name + " ShelfOutProcess 出错:" + ex.ToString());
}
finally
{
LowProcess = false;
}
catch (Exception ex)
});
}
else
{
LogUtil.error(Name + " ShelfOutProcess 出错:" + ex.ToString());
LogUtil.OutputDebugString($"ShelfOutProcess Line_OutCheck:{IOValue(IO_Type.Line_OutCheck)}, Line_BufferCheck:{IOValue(IO_Type.Line_BufferCheck)}, Line_Stop4_Out:{IOValue(IO_Type.Line_Stop4_Out)}, LowProcess:{LowProcess}");
lowWatch.Stop();
}
}
#endregion
......@@ -711,26 +745,26 @@ namespace OnlineStore.DeviceLibrary
return num;
}
public void LineRun(StoreMoveInfo move=null )
public void LineRun(StoreMoveInfo move=null, string parentname = "")
{
//LogUtil.info(Name + "线体运转");
if (move != null)
{
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_BackRun, IO_VALUE.LOW));
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.HIGH));
}
IOMove(IO_Type.Line_BackRun, IO_VALUE.LOW);
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
LineRun("n", 999, parentname);
}
public void LineStop(StoreMoveInfo move=null )
public void LineStop(StoreMoveInfo move=null, string parentname = "")
{
//LogUtil.info(Name + "线体停止");
if (move != null)
{
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_BackRun, IO_VALUE.LOW));
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.LOW));
}
IOMove(IO_Type.Line_BackRun, IO_VALUE.LOW);
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
LineStop("n", parentname);
}
public bool OpenAllAxis(bool isCheck = true)
......
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace OnlineStore.DeviceLibrary
{
partial class DUOStoreBean
{
Timer lineTimer = null;
Dictionary<string, DateTime> linrunlist = new Dictionary<string, DateTime>();
void LineInit() {
if (lineTimer == null) {
lineTimer = new Timer(300);
lineTimer.Elapsed += LineTimer_Elapsed;
lineTimer.Start();
GC.KeepAlive(lineTimer);
}
}
private void LineTimer_Elapsed(object sender, ElapsedEventArgs e)
{
lock (linrunlist)
{
if (canStopLine(out _) && IOValue(IO_Type.Line_Run).Equals(IO_VALUE.HIGH))
{
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
LogUtil.info(Name + $" 线体管理器 停止线体.");
}
}
}
/// <summary>
/// 控制线体运转
/// </summary>
/// <param name="id">需求方标识</param>
/// <param name="seconds">秒数</param>
void LineRun(string id, int seconds, string parentname="") {
LineInit();
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
lock (linrunlist)
{
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
if (!string.IsNullOrEmpty(id) && seconds > 0)
{
if (linrunlist.ContainsKey(id))
linrunlist[id] = DateTime.Now.AddSeconds(seconds);
else
{
linrunlist.Add(id, DateTime.Now.AddSeconds(seconds));
}
LogUtil.info(Name + $" 线体管理器 {id},{parentname} 请求链条运行 {seconds}秒.");
}
}
}
void LineStop(string id = "", string parentname = "") {
lock (linrunlist)
{
if (!string.IsNullOrEmpty(id))
{
if (linrunlist.ContainsKey(id))
linrunlist.Remove(id);
LogUtil.info(Name + $" 线体管理器 {id},{parentname} 请求立刻停止线体.");
}
}
if (!canStopLine(out string msg))
LogUtil.info(Name + $" {msg}");
// IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
}
bool canStopLine(out string msg)
{
msg = "";
bool canStop = true;
lock (linrunlist)
{
foreach (var x in linrunlist.ToList()) {
if (x.Value > DateTime.Now)
{
canStop = false;
msg = Name + $" 线体管理器 {x.Key} 不允许停止线体 需求停止时间 {x.Value.ToString()}.";
//LogUtil.info(Name + $" {x.Key} 不允许停止线体 需求停止时间 {x.Value.ToString()}.");
}
else {
LogUtil.info(Name + $" 线体管理器 {x.Key} 请求时间已过期,删除.");
linrunlist.Remove(x.Key);
}
}
}
return canStop;
}
}
}
......@@ -67,10 +67,11 @@ namespace OnlineStore.DeviceLibrary
}
else if (wait.WaitType.Equals(WaitEnum.W009_ScanCode))
{
if (LastCodeList.Count > 0)
{
if (scanTask == null)
return true;
if (scanTask.IsCompleted)
return true;
}
}
return false;
}
......@@ -112,7 +113,7 @@ namespace OnlineStore.DeviceLibrary
return false;
}
public override bool StartOutStoreMove(InOutParam param)
public override bool StartOutStoreMove(InOutParam param, bool shelfisready = false)
{
//判断是哪个工位有料架
if (IOValue(IO_Type.Line_WorkCheck).Equals(IO_VALUE.HIGH))
......@@ -124,7 +125,17 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NewMove(MoveType.OutStore, new InOutParam(MoveType.OutStore));
LogUtil.info(Name + " 当前料架["+CurrShelfNum+"]["+CurrShelfType+"],开始出库");
UpdateShelfNum(CurrShelfNum, 2);
if (shelfisready)
{
LogUtil.info(Name + " 料架已就位");
MoveInfo.NextMoveStep(StoreMoveStep.LO_08_AxisUpToP2);
//L_05_WaitTime(StoreMoveStep.LO_08_AxisUpToP2);
}
else
{
LogUtil.info(Name + " 检测料架");
L_05_WaitTime(StoreMoveStep.LO_05_WaitTime);
}
return true;
}
}
......@@ -146,7 +157,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NewMove(MoveType.OutStore, outParam);
//可以开始出库啦
MoveInfo.NextMoveStep(StoreMoveStep.LO_11_BatchAxisDown);
int height = outParam.PlateH + 4;
int height = outParam.PlateH + 2;
int targetPosition = T1_BatchAxis.GetAclPosition() - height * Config.BatchAxis_ChangeValue;
if (targetPosition < Config.BatchAxis_P1)
{
......@@ -180,7 +191,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StoreMoveStep.LO_05_WaitTime))
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_06_TopUp);
LineStop(null);
LineStop("n", "LO_06_TopUp");
InOutStoreLog("料架出库: 顶升气缸上升");
CylinderMove(MoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_Up);
}
......@@ -275,8 +286,8 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StoreMoveStep.LO_15_UpdownUp))
{
if (BoxMap[MoveInfo.MoveParam.TargetBox].IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.LOW)) {
BoxMap[MoveInfo.MoveParam.TargetBox].MoveInfo.MoveParam.TargetPosition = 1;
BoxMap[MoveInfo.MoveParam.TargetBox].MoveInfo.NextMoveStep(StoreMoveStep.SO_14_InoutToP1);
//BoxMap[MoveInfo.MoveParam.TargetBox].MoveInfo.MoveParam.TargetPosition = 1;
//BoxMap[MoveInfo.MoveParam.TargetBox].MoveInfo.NextMoveStep(StoreMoveStep.SO_14_InoutToP1);
}
MoveInfo.NextMoveStep(StoreMoveStep.LO_16_MiddleToP1);
......@@ -308,7 +319,9 @@ namespace OnlineStore.DeviceLibrary
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
//只有提升轴位置过低时才需要到P3
int currPosition = T1_BatchAxis.GetAclPosition();
if (currPosition <= (Config.BatchAxis_P1 + Config.BatchAxis_ChangeValue * 40))
int reoppos = (Config.BatchAxis_P1 + Config.BatchAxis_ChangeValue * 150);
InOutStoreLog($"料盘移栽: 当前T1位置[{currPosition}],最低需要重新上升位置:[{reoppos}]");
if (currPosition <= reoppos)
{
InOutStoreLog("料盘移栽: 升降轴到料串高点[" + Config.UpdownAxis_P2 + "],提升轴[" + currPosition + "]需要到P2");
BatchAxisToP2(false);
......@@ -365,7 +378,7 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog("送出料架:上料阻挡下降1秒,流水线开始转动");
UpdateShelfNum(-1, -1);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
LineRun(MoveInfo);
LineRun(MoveInfo, "LO_34_WorkStopDown");
IOMove(IO_Type.Line_Stop2_Work, IO_VALUE.HIGH, false, 1500);
}
......@@ -374,14 +387,14 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.LO_35_WaitShelfGo);
InOutStoreLog("送出料架:等待上料无料架");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_WaitCheck, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_WorkCheck, IO_VALUE.LOW));
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_35_WaitShelfGo))
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_36_LineRun);
InOutStoreLog("送出料架:流水线再转动3秒");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
LineRun(MoveInfo);
LineRun(MoveInfo, "LO_36_LineRun");
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_36_LineRun))
{
......@@ -453,9 +466,10 @@ namespace OnlineStore.DeviceLibrary
try
{
InShelfInProcess = true;
LineRun(null);
LineRun("ShelfEnterProcess",10);
//等待进料检测信号
bool result = WaitIo(IO_Type.Line_InCheck, IO_VALUE.LOW, 10000);
LineRun("ShelfEnterProcess", 3);
}
catch (Exception ex)
{
......@@ -463,7 +477,7 @@ namespace OnlineStore.DeviceLibrary
finally
{
InShelfInProcess = false;
LineStop(null);
//LineStop("ShelfEnterProcess");
}
});
}
......@@ -476,7 +490,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.Line_Stop1_Wait, IO_VALUE.LOW);
IOMove(IO_Type.Line_Stop2_Work, IO_VALUE.LOW);
LineRun(MoveInfo);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_WorkCheck, IO_VALUE.HIGH));
}
......@@ -496,14 +510,14 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.Line_Stop2_Work, IO_VALUE.LOW);//缓冲阻挡前进1000
LineRun(MoveInfo);
//等待指定时间
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_WorkCheck, IO_VALUE.HIGH));
}
else
{
if (!InShelfInProcess)
{
LineStop(null);
LineStop("n", "LI_04_LineStart,!InShelfInProcess");
}
MoveEndP();
......@@ -594,7 +608,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_06_TopUp);
InOutStoreLog("入料检测:链条停止转动, 顶升气缸上升");
LineStop(MoveInfo);
LineStop("n", "LI_06_TopUp");
CurrShelfNum = ConfigAppSettings.GetIntValue(Setting_Init.CurrShelfNum);
CurrShelfType = ConfigAppSettings.GetIntValue(Setting_Init.CurrShelfType);
if (GetShelfNum() == CurrShelfNum && CurrShelfType == 2)
......@@ -602,7 +616,8 @@ namespace OnlineStore.DeviceLibrary
UpdateShelfNum(GetShelfNum(), CurrShelfType);
MoveEndP();
}
else {
else
{
CurrShelfType = 1;
UpdateShelfNum(GetShelfNum(), CurrShelfType);
}
......@@ -631,7 +646,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_11_AxisToTray);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
InOutStoreLog("入料检测:有料盘:升降轴到料串高点P2["+ Config.UpdownAxis_P2 + "],旋转轴到料串位置P4["+ Config.MiddleAxis_P4 + "]");
InOutStoreLog("入料检测:有料盘:升降轴到料串高点P2[" + Config.UpdownAxis_P2 + "],旋转轴到料串位置P4[" + Config.MiddleAxis_P4 + "]");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed);
......@@ -642,7 +657,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StoreMoveStep.LI_11_AxisToTray))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_12_UpdownAxisToP3);
InOutStoreLog("取料:升降轴到料串低点P1["+ Config.UpdownAxis_P1 + "]");
InOutStoreLog("取料:升降轴到料串低点P1[" + Config.UpdownAxis_P1 + "]");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_12_UpdownAxisToP3))
......@@ -654,19 +669,40 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StoreMoveStep.LI_13_CylinderTighten))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_14_UpdownToP1);
InOutStoreLog("取料:升降轴到料串高点P2["+ Config.UpdownAxis_P2 + "]");
InOutStoreLog("取料:升降轴到料串高点P2[" + Config.UpdownAxis_P2 + "]");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_14_UpdownToP1))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_15_WaitNoCheck);
if (MoveInfo.IsTimeOut(15))
{
if (IOValue(IO_Type.AutoRun_BTN).Equals(IO_VALUE.HIGH))
{
ClearTimeoutAlarm("抓取料盘失败");
MoveInfo.NextMoveStep(StoreMoveStep.LI_25_UpdownUp);
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Clamp, IO_Type.ClampCylinder_Relax);
//T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P1, Config.MiddleAxis_P1Speed);
}
else
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 抓取料盘失败,请手动取走料盘 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, ID * 1000 + 50);
Alarm(AlarmType.IoSingleTimeOut);
}
}
else if (IOValue(IO_Type.ClampCylinder_Check).Equals(IO_VALUE.HIGH))
{
InOutStoreLog("取料:等待没有提升机构料盘检测");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.BatchAxis_Check, IO_VALUE.HIGH));
MoveInfo.NextMoveStep(StoreMoveStep.LI_15_WaitNoCheck);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.BatchAxis_Check, IO_VALUE.LOW));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampCylinder_Check, IO_VALUE.HIGH));
}
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_15_WaitNoCheck))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_16_BatchAxisToP2);
InOutStoreLog("取料:批量轴到P2 ["+Config.BatchAxis_P2+"],计算高度,");
InOutStoreLog("取料:批量轴到P2 [" + Config.BatchAxis_P2 + "],计算高度,");
BatchAxisToP2(false);
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_16_BatchAxisToP2))
......@@ -675,6 +711,7 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog("取料:记录高度尺寸");
LastWidth = GetWidth();
LastHeight = GetHeight();
MoveInfo.WaitList.Add(WaitResultInfo.WaitScanCode());
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_17_SaveSize))
......@@ -738,8 +775,8 @@ namespace OnlineStore.DeviceLibrary
if (storeId == -1)
storeId = LastPosParam.TargetBox;
if (IOManager.IOValue(IO_Type.InDoor_Check, storeId).Equals(IO_VALUE.LOW))// && box.waitInStoreParam == null)
bool boxdoorready = BoxMap[storeId].InoutAxis.GetAclPosition() < (BoxMap[storeId].Config.InOutAxis_P2 - BoxMap[storeId].Config.InOutAxis_P1) / 2;
if (IOManager.IOValue(IO_Type.InDoor_Check, storeId).Equals(IO_VALUE.LOW) && boxdoorready)// && box.waitInStoreParam == null)
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_22_ToBoxDoor);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
......@@ -749,6 +786,7 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog("料盘移栽:获取库位号完成, BOX " + storeId + " 升降轴到料门口高点P4[" + Config.UpdownAxis_P4 + "],旋转轴到料仓门口 P2[" + Config.MiddleAxis_P2 + "]");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P4, Config.UpdownAxis_P4Speed);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P2, Config.MiddleAxis_P2Speed);
}
else
{
......@@ -756,7 +794,12 @@ namespace OnlineStore.DeviceLibrary
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P6, Config.UpdownAxis_P6Speed);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P3, Config.MiddleAxis_P3Speed);
}
if (!LastPosParam.InStoreNg && !BoxMap[storeId].ReviceInStoreCMD(LastPosParam.PosID, LastPosParam.PlateH, LastPosParam.PlateW, LastPosParam.WareCode))
{
LogInfo(" 入库验证失败送出. ");
LastPosParam.InStoreNg = true;
StoreManager.cancelPutInTask(Name, LastPosParam.WareCode);
}
ClearTimeoutAlarm("入料口无料盘");
}
else if (MoveInfo.IsTimeOut(120))
......@@ -768,17 +811,18 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_22_ToBoxDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_23_UpdownDown);
int storeId = LastPosParam.GetStoreId();
BoxBean box;
if (storeId == -1)
storeId = LastPosParam.TargetBox;
box = BoxMap[storeId];
InOutStoreLog($"料盘移栽:storeId={storeId},targetpos={LastPosParam.TargetPosition}");
box.waitInStoreParam = LastPosParam.clone();
MoveInfo.NextMoveStep(StoreMoveStep.LI_22a_ToBoxDoor);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_22a_ToBoxDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_22b_ToBoxDoor);
YuScanCode();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_22b_ToBoxDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_23_UpdownDown);
if (LastPosParam.TargetBox.Equals(1))
{
InOutStoreLog("料盘移栽: 升降轴到料门口低点P3[" + Config.UpdownAxis_P3 + "],开始预扫码");
......@@ -809,12 +853,19 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog("料盘移栽: 升降轴到料门口高点P6[" + Config.UpdownAxis_P6 + "]");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P6, Config.UpdownAxis_P6Speed);
}
int storeId = LastPosParam.GetStoreId();
BoxBean box;
if (storeId == -1)
storeId = LastPosParam.TargetBox;
box = BoxMap[storeId];
InOutStoreLog($"料盘移栽:storeId={storeId},targetpos={LastPosParam.TargetPosition}");
box.waitInStoreParam = LastPosParam.clone();
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_25_UpdownUp))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_26_AxisToWait);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
InOutStoreLog("料盘移栽:旋转轴返回待机点P1["+ Config.MiddleAxis_P1 + "],升降轴到料串高点P2["+ Config.UpdownAxis_P2 + "]");
InOutStoreLog("料盘移栽:旋转轴返回待机点P1[" + Config.MiddleAxis_P1 + "],升降轴到料串高点P2[" + Config.UpdownAxis_P2 + "]");
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P1, Config.MiddleAxis_P1Speed);
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
}
......@@ -863,7 +914,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.LI_35_WaitShelfGo);
InOutStoreLog("送出料架:等待上料无料架");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_WaitCheck, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_WorkCheck, IO_VALUE.LOW));
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_35_WaitShelfGo))
{
......@@ -977,9 +1028,13 @@ namespace OnlineStore.DeviceLibrary
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed);
}
Task<List<string>> scanTask;
private void LI_09_ScanCode()
{
if (yuscanTask != null && !yuscanTask.IsCompleted)
return;
yuscanTask = null;
MoveInfo.NextMoveStep(StoreMoveStep.LI_09_ScanCode);
LastCodeList = new List<string>();
......@@ -996,14 +1051,14 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog("料盘移栽 :开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitScanCode());
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
try
{
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
scanTask = Task.Factory.StartNew(delegate
{
IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
Task.Delay(10).Wait();
Task.Delay(1000).Wait();
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name);
if (LastCodeList.Count <= 0)
......@@ -1020,9 +1075,12 @@ namespace OnlineStore.DeviceLibrary
}
}
}
Task<List<string>> yuscanTask=null;
private void YuScanCode()
{
if (ConfigAppSettings.GetIntValue(Setting_Init.yuscan) == 0)
return;
//TODO 此处需要等待空托盘
if (ShelfNoTray.Equals(false))
{
......@@ -1030,12 +1088,11 @@ namespace OnlineStore.DeviceLibrary
//还有料盘,直接扫码
YuCodeList = new List<string>();
List<string> bijiaoList = new List<string>(LastCodeList);
try
{
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
yuscanTask = Task.Factory.StartNew(delegate
{
IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
Task.Delay(10).Wait();
Task.Delay(50).Wait();
YuCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name.Trim() + "预扫码");
IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
bool isCanUse = true;
......@@ -1062,17 +1119,13 @@ namespace OnlineStore.DeviceLibrary
//}
return YuCodeList;
});
}
catch (Exception ex)
{
LogUtil.error(" 为下一盘料扫码出错:", ex);
}
}
}
private void CheckHasTray()
{
if (IOValue(IO_Type.BatchAxis_Check).Equals(IO_VALUE.LOW) && ShelfNoTray.Equals(false))
if (IOValue(IO_Type.BatchAxis_Check).Equals(IO_VALUE.HIGH) && ShelfNoTray.Equals(false))
{
LI_09_ScanCode();
}
......@@ -1094,8 +1147,53 @@ namespace OnlineStore.DeviceLibrary
}
//无料盘
ShelfNoTray = true;
UpdateShelfNum(CurrShelfNum, 0);
int box1miscout = 0;
int box2miscout = 0;
bool hasMission = false;
int MissionTest = 0;
while (MissionTest < 10 && !hasMission)
{
//lock (BoxMap[1].waitOutStoreList)
{
var box1wl = BoxMap[1].waitOutStoreList.ToList();
box1miscout = (from a in box1wl where a.TargetPosition == 0 select a).Count();
}
//lock (BoxMap[2].waitOutStoreList)
{
var box1wl = BoxMap[2].waitOutStoreList.ToList();
box2miscout = (from a in box1wl where a.TargetPosition == 0 select a).Count();
}
//如果有等待出库的料先出库
if (box1miscout > 0 || box2miscout > 0)
hasMission = true;
MissionTest++;
Thread.Sleep(50);
}
if (!hasMission)
{
hasMission = BoxMap[1].MoveInfo.MoveStep == StoreMoveStep.SO_11_GoBack || BoxMap[2].MoveInfo.MoveStep == StoreMoveStep.SO_11_GoBack;
}
InOutStoreLog($"检测料架为空:BoxMap[1]={box1miscout},BoxMap[2]={box2miscout}");
if (hasMission)
{
InOutStoreLog("检测料架为空:检测到有待出库料盘,立刻开始出库");
if (!StartOutStoreMove(new InOutParam(MoveType.OutStore), true))
{
InOutStoreLog("检测料架为空:转换出库失败.");
//MoveEndP();
}
}
else
{
LI_31_BatchAxisToP1();
}
}
}
private void LI_31_BatchAxisToP1()
......@@ -1135,7 +1233,7 @@ namespace OnlineStore.DeviceLibrary
T1_BatchAxis.AbsMove(null, targetP2, targetSpeed);
LogUtil.info(Name + " BatchAxisToP2 目标P2: " + targetP2);
//开始检测信号
T1_BatchAxis.BatchAxisStartCheck(IO_Type.BatchAxis_Check, IO_VALUE.LOW);
T1_BatchAxis.BatchAxisStartCheck(IO_Type.BatchAxis_Check, IO_VALUE.HIGH);
}
private int GetHeight()
......
......@@ -10,6 +10,7 @@ using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
using crc = CodeResourceControl;
public abstract class EquipBase : KTK_Store
{
internal int logType = 1000;
......@@ -155,7 +156,8 @@ namespace OnlineStore.DeviceLibrary
//}
if (value == 1)
{
WarnMsg = Name + " 运动轴" + axisInfo.Config.Explain + "报警";
//WarnMsg = Name + " 运动轴" + axisInfo.Config.Explain + "报警";
WarnMsg = Name + " " + crc.GetString("axis_alarm", "运动轴{0}报警", axisInfo.Config.Explain);
Alarm(AlarmType.AxisAlarm, GetAlarmCodeByAxis(axisInfo.Config).ToString(), WarnMsg, MoveType.None);
isInAlarm = true;
}
......@@ -240,7 +242,8 @@ namespace OnlineStore.DeviceLibrary
else if (span.TotalMilliseconds > timeOutMs && NoAlarm())
{
WarnMsg = Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时";
//WarnMsg = Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时";
WarnMsg = crc.GetString("WarnMsg_io_timeout", "{0}[{1}][2]等待{3}={4}超时", Name, MoveInfo.MoveType, MoveInfo.MoveStep, io.DisplayStr, wait.IoValue);
Alarm(AlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType);
LogUtil.error(Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", logType + 14);
if (!MoveInfo.OneWaitCanEndStep)
......@@ -282,8 +285,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (span.TotalSeconds > MoveInfo.TimeOutSeconds)
{
WarnMsg = Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待" + NotOkMsg
+ "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
//WarnMsg = Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待" + NotOkMsg + "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
WarnMsg = crc.GetString("WarnMsg_timeout","{0}[{1}][2]等待{3}超时[{4}]秒", Name, MoveInfo.MoveType, MoveInfo.MoveStep, NotOkMsg, Math.Round(span.TotalSeconds, 1));
int second = 10;
second = (int)(MoveInfo.TimeOutSeconds / span.TotalSeconds) * 10;
......@@ -309,9 +312,9 @@ namespace OnlineStore.DeviceLibrary
public string GetMoveStr()
{
string msg = "";
msg += "状态: " + runStatus + " " + storeStatus + "\n";
msg += crc.GetString("table_state","状态")+": " + runStatus + " " + storeStatus + "\n";
// msg += "lineS: " + storeStatus + "\n";
msg += "报警: " + alarmType + "\n";
msg += crc.GetString("table_alarm", "报警")+": " + alarmType + "\n";
msg += MoveInfo.MoveType + " " + MoveInfo.SLog + "\n";
return msg;
}
......
......@@ -82,7 +82,9 @@ namespace OnlineStore.DeviceLibrary
{
humidity = param.Humidity;
temp = param.Temperate;
LastData = param;
currTempStr = Name + ("湿度:" + humidity.ToString() + ",温度:" + temp);
LogUtil.OutputDebugString(currTempStr);
}
//double currMaxHumidity = HumitureServer.GetMaxHumidity(Config.GetTempAddrList());
double currMaxHumidity = param.Humidity;
......
......@@ -21,6 +21,7 @@ namespace OnlineStore.DeviceLibrary
public static Dictionary<int, BaseConfig> AllConfigMap = null;
private static bool isInit = false;
public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
public StoreManager()
{
}
......@@ -218,25 +219,21 @@ namespace OnlineStore.DeviceLibrary
p.UpDown_P2 = box.Config.UpDownAxis_P2;
// p.UpDown_P7 = box.Config.UpDownAxis_DoorOBPosition_P7;
if (param.TargetPosition == 1)
{
p.ComPress_P2 = box.Config.GetComP2(param.PlateH);
p.ComPress_P3 = box.Config.CompAxis_P3;
}
else
{
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(param.PosID);
if (position == null)
{
if (movetype.Equals(MoveType.InStore) && param.TargetPosition.Equals(1))
{
param.MoveP = p;
return true;
}
LogUtil.error(box.Name + "GetPositon[" + param.PosID + "]=null,没有库位不能执行出入库");
return false;
}
if (param.PlateH <= 0)
{
param.PlateH = position.BagHigh;
......@@ -245,15 +242,16 @@ namespace OnlineStore.DeviceLibrary
{
param.PlateW = position.BagWidth;
}
p.ComPress_P2 = box.Config.GetComP2(position.BagHigh);
p.ComPress_P3 = box.Config.CompAxis_P3;
//p.ComPress_P3 = position.ComAxis_P3;
p.InOut_P3 = position.InoutAxis_P3;
p.Middle_P2 = position.MiddleAxis_P2;
p.UpDown_P3 = position.UpdownAxis_IH_P3;
p.UpDown_P4 = position.UpdownAxis_IL_P4;
p.UpDown_P5 = position.UpdownAxis_OH_P5;
p.UpDown_P6 = position.UpdownAxis_OL_P6;
}
param.MoveP = p;
......@@ -323,7 +321,7 @@ namespace OnlineStore.DeviceLibrary
// 取消任务地址: /cancelPutInTask //参数: barcode
private static string Addr_cancelPutInTask = "/rest/api/qisda/device/cancelPutInTask";
private static string Addr_cancelPutInTask = "/service/store/cancelPutInTask";
public static string cancelPutInTask(string deviceName, string barcode)
{
string msg = "";
......@@ -384,7 +382,8 @@ namespace OnlineStore.DeviceLibrary
string cids = "";
foreach (int k in Store.BoxMap.Keys)
{
if (Store.BoxMap[k].runStatus > StoreRunStatus.Wait && Store.BoxMap[k].IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.LOW))
//if (Store.BoxMap[k].runStatus > StoreRunStatus.Wait && Store.BoxMap[k].IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.LOW))
if (!Store.BoxMap[k].IsDebug && !Store.BoxMap[k].Disabled && Store.BoxMap[k].runStatus > StoreRunStatus.Wait)
{
cids += Store.BoxMap[k].CID + ",";
}
......
......@@ -55,7 +55,7 @@ namespace OnlineStore.DeviceLibrary
}
if (storeMoveType.Equals(MoveType.InStore))
{
int newIndex = positionIndex - Jiange;
int newIndex = positionIndex;
if (newIndex < 0)
{
if (startIndex >= 0 && startIndex < boxBean.PositionNumList.Count)
......@@ -92,7 +92,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (storeMoveType.Equals(MoveType.OutStore))
{
int newIndex = positionIndex;
int newIndex = positionIndex - Jiange;
if (newIndex < 0)
{
if (startIndex >= 0 && startIndex < boxBean.PositionNumList.Count)
......
......@@ -12,6 +12,7 @@ using System.Text;
namespace OnlineStore.DeviceLibrary
{
using crc = CodeResourceControl;
public class InOutParam
{
/// <summary>
......@@ -112,11 +113,15 @@ namespace OnlineStore.DeviceLibrary
string[] arr = posId.Split('#');
if (arr.Length >= 2)
{
return int.Parse(arr[0]);
var p = int.Parse(arr[1].Substring(2, 1));
switch (p) {
case 3:
return 1;
case 4:
return 2;
default:
return p;
}
else
{
return int.Parse(posId.Substring(2, 2));
}
}
catch (Exception ex)
......@@ -130,23 +135,23 @@ namespace OnlineStore.DeviceLibrary
{
if (InStoreNg)
{
return " 入库失败[BOX_" + TargetBox + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ";
return crc.GetString("instore_fail"," 入库失败")+"[BOX_" + TargetBox + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ";
}
else
{
if (moveType.Equals(MoveType.InStore))
{
return " 入库 [" + PosID + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ";
return crc.GetString("instore"," 入库")+ "[" + PosID + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ";
}
else
{
if (TargetPosition.Equals(1))
if (TargetPosition.Equals(0))
{
return " 批量出库 [" + PosID + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ";
return crc.GetString("batch_outstore"," 批量出库")+"[" + PosID + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ";
}
else
{
return " 单盘出库 [" + PosID + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ";
return crc.GetString("single_outstore"," 单盘出库")+ "[" + PosID + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ";
}
}
}
......
using DeviceLib;
using CodeLibrary;
using DeviceLib;
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
......@@ -12,6 +13,7 @@ using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
using crc = CodeResourceControl;
/// <summary>
/// 康泰克单台自动料仓
/// </summary>
......@@ -243,7 +245,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始出库运动
/// </summary>
public abstract bool StartOutStoreMove(InOutParam param);
public abstract bool StartOutStoreMove(InOutParam param, bool shelfisready = false);
protected abstract void OutStoreProcess();
#endregion
......@@ -259,24 +261,24 @@ namespace OnlineStore.DeviceLibrary
public string GetRunStr()
{
string sta = "运行中";
string sta = crc.GetString("state_running","运行中");
string aa = "";
switch (runStatus)
{
case StoreRunStatus.Busy:
sta = "忙碌";
sta = crc.GetString("state_busy", "忙碌");
break;
case StoreRunStatus.HomeMoving:
sta = "原点返回";
sta = crc.GetString("state_homereset", "原点返回");
break;
case StoreRunStatus.Reset:
sta = "重置";
sta = crc.GetString("state_reset", "重置");
break;
case StoreRunStatus.Runing:
sta = "运行中";
sta = crc.GetString("state_running", "运行中");
break;
case StoreRunStatus.Wait:
sta = "等待启动";
sta = crc.GetString("state_waitforstart", "等待启动");
break;
}
if (runStatus > StoreRunStatus.Wait)
......@@ -285,37 +287,37 @@ namespace OnlineStore.DeviceLibrary
switch (storeStatus)
{
case StoreStatus.Debugging:
aa = "设备调试中";
aa = crc.GetString("state_device_debug", "设备调试中");
break;
case StoreStatus.InStoreEnd:
aa = "料盘入仓位完成";
aa = crc.GetString("state_inpos_finish", "料盘入仓位完成");
break;
case StoreStatus.InStoreExecute:
aa = "入库执行中";
aa = crc.GetString("state_instore_process", "入库执行中");
break;
case StoreStatus.InTrouble:
aa = "故障中";
aa = crc.GetString("state_device_fail", "故障中");
break;
case StoreStatus.OutStoreBoxEnd:
aa = "料盘出仓位完成";
aa = crc.GetString("state_outpos_finish", "料盘出仓位完成");
break;
case StoreStatus.OutStoreExecute:
aa = "出库执行中";
aa = crc.GetString("state_outstore_process", "出库执行中");
break;
case StoreStatus.StoreOnline:
aa = "设备联机";
aa = crc.GetString("state_device_online", "设备联机");
break;
case StoreStatus.SuddenStop:
aa = "急停中";
aa = crc.GetString("state_scramming", "急停中");
break;
case StoreStatus.OutMoveExecute:
aa = "出库完成";
aa = crc.GetString("state_outstore_finish", "出库完成");
break;
case StoreStatus.InStoreFaild:
aa = "入库失败(" + WarnMsg + ")";
aa = crc.GetString("state_inpos_fail_with_reason", "入库失败({0})", WarnMsg);
break;
case StoreStatus.OutStoreFaild:
aa = "出库失败(" + WarnMsg + ")";
aa = crc.GetString("state_outpos_fail_with_reason", "出库失败({0})", WarnMsg);
break;
}
if (!aa.Equals(""))
......
......@@ -427,7 +427,8 @@ namespace OnlineStore.DeviceLibrary
/// 料盘移栽:获取库位号完成,升降轴到料门口高点,旋转轴到料仓门口
/// </summary>
LI_22_ToBoxDoor,
LI_22a_ToBoxDoor,
LI_22b_ToBoxDoor,
/// <summary>
/// 料盘移栽: 升降轴到料门口低点,开始预扫码
/// </summary>
......@@ -602,6 +603,12 @@ namespace OnlineStore.DeviceLibrary
///送出料架, 流水线停止转动,
/// </summary>
LO_37_LineStop,
BOX_H03_OtherAxisHome_wait,
BOX_H03_SendOut_01,
BOX_H03_SendOut_02,
BOX_H03_SendOut_03,
BOX_H03_SendOut_04,
BOX_H03_SendOut_05,
#endregion
......
......@@ -198,7 +198,7 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
if (array.Length == titleIndex.Count)
if (array.Length >= titleIndex.Count)
{
if (csvIndex < 0)
{
......
......@@ -8,6 +8,7 @@ using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
using crc = CodeResourceControl;
public class CSVConfigReader : CSVReaderBase
{
private static Dictionary<Type, Dictionary<string, string>> allItemProTitleMap = null;
......@@ -111,6 +112,10 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
if (proName == "Explain" && (array[0]=="AXIS" || array[0] == "DI" || array[0] == "DO"))
{
value = crc.GetString(array[3], value);
}
prop.SetValue(bllIns, Convert.ChangeType(value, prop.PropertyType), null);//赋值****在这里需要考虑类型问题
}
}
......
......@@ -8,6 +8,7 @@ using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
using crc = CodeResourceControl;
public class ConfigBase
{
/// <summary>
......@@ -168,7 +169,7 @@ namespace OnlineStore.LoadCSVLibrary
io.ElectricalDefinition = this.ElectricalDefinition;
io.ProType = this.ProType;
io.SubType = this.SubType;
io.Explain = this.Explain ;
io.Explain = crc.GetString(ProName, Explain);
io.ProValue = this.ProValue;
io.ProName = this.ProName + suffix;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!