Commit 9ecc8e31 刘韬

合并LN_07 Jan, 2021 1 次提交

1 个父辈 b35ac40c
......@@ -8,7 +8,7 @@
private System.ComponentModel.IContainer components = null;
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
......@@ -65,7 +65,7 @@
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.btnCloseDeviceLed);
this.groupBox1.Controls.Add(this.btnOpenDeviceLed);
......@@ -102,7 +102,7 @@
this.groupBox1.Size = new System.Drawing.Size(456, 608);
this.groupBox1.TabIndex = 105;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "DO写入";
this.groupBox1.Text = "IO状态修改";
//
// btnCloseDeviceLed
//
......@@ -155,7 +155,7 @@
this.btnDisDoorClose.Name = "btnDisDoorClose";
this.btnDisDoorClose.Size = new System.Drawing.Size(135, 52);
this.btnDisDoorClose.TabIndex = 268;
this.btnDisDoorClose.Text = "激活电气维护门警报";
this.btnDisDoorClose.Text = "激活维护门警报";
this.btnDisDoorClose.UseVisualStyleBackColor = true;
this.btnDisDoorClose.Click += new System.EventHandler(this.btnDisDoorClose_Click);
//
......@@ -166,7 +166,7 @@
this.btnDisDoorOpen.Name = "btnDisDoorOpen";
this.btnDisDoorOpen.Size = new System.Drawing.Size(135, 52);
this.btnDisDoorOpen.TabIndex = 267;
this.btnDisDoorOpen.Text = "关闭电气维护门警报";
this.btnDisDoorOpen.Text = "关闭维护门警报";
this.btnDisDoorOpen.UseVisualStyleBackColor = true;
this.btnDisDoorOpen.Click += new System.EventHandler(this.btnDisDoorOpen_Click);
//
......@@ -188,7 +188,7 @@
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(135, 52);
this.button5.TabIndex = 265;
this.button5.Text = "打开进气口";
this.button5.Text = "开启进气口";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
......@@ -277,7 +277,7 @@
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(104, 32);
this.label3.TabIndex = 247;
this.label3.Text = "选择:";
this.label3.Text = "端口:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnOpenLed
......@@ -384,7 +384,7 @@
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(103, 30);
this.label5.TabIndex = 237;
this.label5.Text = "保持(ms):";
this.label5.Text = "保持时间(ms):";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// cmbWriteIO
......@@ -437,7 +437,7 @@
//
// groupBox4
//
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox4.Controls.Add(this.tableLayoutPanel2);
this.groupBox4.Location = new System.Drawing.Point(376, 3);
......@@ -449,8 +449,8 @@
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.tableLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel2.AutoScroll = true;
this.tableLayoutPanel2.ColumnCount = 1;
......@@ -465,7 +465,7 @@
//
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox3.Controls.Add(this.tableLayoutPanel1);
this.groupBox3.Location = new System.Drawing.Point(12, 3);
......@@ -477,8 +477,8 @@
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.AutoScroll = true;
this.tableLayoutPanel1.ColumnCount = 1;
......@@ -555,4 +555,3 @@
private System.Windows.Forms.Button btnOpenDeviceLed;
}
}
......@@ -1574,6 +1574,8 @@ namespace OnlineStore.AutoInOutStore
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + "");
btnStart.Text = StopAuto;
DebugStatus(false);
string msg = AutomaticBaiting.doStartBatchIn();
LogUtil.info("自动出入库: 开始自动入库:库位号【" + poText + "】,开始入库,结果:" + msg);
}
}
}
......
......@@ -33,7 +33,6 @@
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.picAxis2 = new System.Windows.Forms.PictureBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.ioSingle = new UserFromControl.IOTextControl();
this.txtP4Offset = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.txtP3Offset = new System.Windows.Forms.TextBox();
......@@ -72,6 +71,7 @@
this.btnClear = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.ioSingle = new UserFromControl.IOTextControl();
this.groupBox6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picAxis2)).BeginInit();
this.groupBox2.SuspendLayout();
......@@ -101,7 +101,7 @@
this.picAxis2.Image = ((System.Drawing.Image)(resources.GetObject("picAxis2.Image")));
this.picAxis2.Location = new System.Drawing.Point(453, 13);
this.picAxis2.Name = "picAxis2";
this.picAxis2.Size = new System.Drawing.Size(551, 542);
this.picAxis2.Size = new System.Drawing.Size(551, 502);
this.picAxis2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picAxis2.TabIndex = 285;
this.picAxis2.TabStop = false;
......@@ -140,17 +140,6 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "位置信息";
//
// ioSingle
//
this.ioSingle.BackColor = System.Drawing.Color.White;
this.ioSingle.IOName = "检测信号";
this.ioSingle.IOValue = 0;
this.ioSingle.isCanClick = false;
this.ioSingle.Location = new System.Drawing.Point(46, 425);
this.ioSingle.Name = "ioSingle";
this.ioSingle.Size = new System.Drawing.Size(202, 28);
this.ioSingle.TabIndex = 289;
//
// txtP4Offset
//
this.txtP4Offset.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -540,9 +529,9 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.richTextBox1.Location = new System.Drawing.Point(454, 576);
this.richTextBox1.Location = new System.Drawing.Point(454, 521);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(549, 88);
this.richTextBox1.Size = new System.Drawing.Size(549, 143);
this.richTextBox1.TabIndex = 105;
this.richTextBox1.Text = "";
//
......@@ -551,6 +540,17 @@
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// ioSingle
//
this.ioSingle.BackColor = System.Drawing.Color.White;
this.ioSingle.IOName = "检测信号";
this.ioSingle.IOValue = 0;
this.ioSingle.isCanClick = false;
this.ioSingle.Location = new System.Drawing.Point(46, 425);
this.ioSingle.Name = "ioSingle";
this.ioSingle.Size = new System.Drawing.Size(202, 28);
this.ioSingle.TabIndex = 289;
//
// FrmPositionTool
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......
......@@ -12,76 +12,53 @@ using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Reflection;
using log4net;
using System.Threading;
namespace OnlineStore.Common
{
public class HttpHelper
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string Post(string url, string paramData)
public static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
private static object lockObj = "";
public static Operation PostOP(string url, Operation operation, int lockTime = 0)
{
return Post(url, paramData, Encoding.UTF8);
}
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <param name="operation"></param>
/// <param name="simulate">是否模拟服务器返回结果</param>
/// <returns></returns>
public static Operation Post(string url, Operation operation, bool simulate)
{
try
if (Monitor.TryEnter(lockObj, lockTime))
{
if (simulate)
{//模拟服务器返回
operation.status = 200;
operation.data.Clear();
operation.data.Add("posId", "A001");
string pos = "D100-111#D102-222#D104-333";
operation.data.Add("pos", pos);
if (operation.op == 1 || operation.op == 2)
{//入库或出库
string json = JsonHelper.SerializeObject(operation);
LogUtil.error(LOGGER, "模拟HTTP服务器返回出库入库信息:" + json);
return operation;
}
}
else
try
{
string json = "";
try
{
json = JsonHelper.SerializeObject(operation);
}
catch (Exception ex)
string json = JsonHelper.SerializeObject(operation);
string result = PostJson(url, json, Encoding.UTF8);
if (operation.op > 0)
{
LOGGER.Error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex);
LogUtil.info("send 【" + url + "】【" + json + "】 " + ",receive 【 " + result + "】");
}
string result = Post(url, json);
if (!string.IsNullOrEmpty(result))
{
try
Operation resultOP = JsonHelper.DeserializeJsonToObject<Operation>(result);
if (resultOP != null && (!operation.seq.Equals(resultOP.seq)))
{
return JsonHelper.DeserializeJsonToObject<Operation>(result);
}
catch (Exception ex)
{
LOGGER.Error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
LogUtil.error(" seq error : send 【" + json + "】 " + ",receive 【 " + result + "】");
}
return resultOP;
}
}
catch (Exception ex)
{
LogUtil.error("PostOP error【operation.op=" + operation.op + "】:" + ex);
}
finally
{
Monitor.Exit(lockObj);
}
}
catch (Exception ex)
else if (lockTime > 10)
{
LOGGER.Error("Post 出错【operation.op=" + operation.op + "】:" + ex);
string json = JsonHelper.SerializeObject(operation);
LogUtil.error(" PostOP " + lockTime + " send " + json + " TryEnter fail ");
}
return null;
}
public static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData="", Encoding encoding=null)
public static string PostJson(string url, string paramData = "", Encoding encoding = null)
{
if (encoding == null)
{
......@@ -89,12 +66,9 @@ namespace OnlineStore.Common
}
if (isLog == 1)
{
LOGGER.Info("给服务器发送数据【" + paramData + "】 ");
}
if (paramData != "null" && paramData != null)
{
// LogUtil.debug(LOGGER, "HTTP POST to " + url + " \n\t >> " + paramData);
LogUtil.info("PostJson Send【" + paramData + "】 ");
}
string result = "";
if (url.ToLower().IndexOf("https", System.StringComparison.Ordinal) > -1)
......@@ -112,19 +86,15 @@ namespace OnlineStore.Common
//paramData = Uri.EscapeDataString(paramData);
result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result);
}
catch (Exception e)
{
LogUtil.error( "POST【"+ paramData + "】 ERROR:" + e.StackTrace, 1);
}
if (!result.Contains("null") && result.Length != 0)
{
//LogUtil.debug(LOGGER,"receive << " + result);
LogUtil.error("PostJson【" + paramData + "】 ERROR:" + e.StackTrace, 1);
}
if (isLog == 1)
{
LOGGER.Info("收到服务器数据【" + result + "】");
LogUtil.info("PostJson Revice【" + result + "】");
}
return result;
}
......@@ -138,21 +108,81 @@ namespace OnlineStore.Common
{
try
{
LogUtil.debug(LOGGER, "HTTP GET FROM: " + url);
LogUtil.debug("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.debug(LOGGER, "receive << " + result);
LogUtil.debug("receive << " + result);
return result;
}
}
catch (Exception e)
{
LogUtil.error( "HTTP GET ERROR:" + e.Message, 2);
LogUtil.error("HTTP GET ERROR:" + e.Message, 2);
}
return "";
}
public static string Post(string url, string paramData = "", int timeOut = 5000)
{
bool IsTimeOut = false;
return Post(url, paramData, Encoding.UTF8, timeOut, out IsTimeOut);
}
public static string Post(string url, string paramData, Encoding encoding, int timeOut, out bool IsTimeOut)
{
if (paramData.Equals(""))
{
int index = url.IndexOf("?");
if (index > 0)
{
paramData = url.Substring(index + 1, url.Length - index - 1);
url = url.Substring(0, index);
}
}
IsTimeOut = false;
if (isLog == 1)
{
LogUtil.info("Send【" + url + "】【" + paramData + "】 ");
}
string result = "";
if (url.ToLower().IndexOf("https", System.StringComparison.Ordinal) > -1)
{
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback((sender, certificate, chain, errors) => { return true; });
}
try
{
var wc = new MyWebClient(timeOut);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result);
}
catch (WebException ex)
{
IsTimeOut = true;
LogUtil.error("POST [" + url + "] WebException :" + ex.ToString());
}
catch (Exception e)
{
LogUtil.error("POST [" + url + "] ERROR:" + e.ToString());
}
if (isLog == 1)
{
LogUtil.info("Revice【" + result + "】");
}
return result;
}
}
}
\ No newline at end of file
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace OnlineStore.Common
{
/// <summary>
/// Json帮助类
/// </summary>
public class JsonHelper
{
/// <summary>
/// Json帮助类
/// 将对象序列化为JSON格式
/// </summary>
public class JsonHelper
/// <param name="o">对象</param>
/// <returns>json字符串</returns>
public static string SerializeObject(object o)
{
/// <summary>
/// 将对象序列化为JSON格式
/// </summary>
/// <param name="o">对象</param>
/// <returns>json字符串</returns>
public static string SerializeObject(object o)
try
{
string json = JsonConvert.SerializeObject(o);
return json;
}
catch (Exception ex)
{
LogUtil.error("JsonHelper.SerializeObject error【" + o.ToString() + "】" + ex);
}
return "";
}
/// <summary>
/// 解析JSON字符串生成对象实体
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json字符串(eg.{"ID":"112","Name":"石子儿"})</param>
/// <returns>对象实体</returns>
public static T DeserializeJsonToObject<T>(string json) where T : class
/// <summary>
/// 解析JSON字符串生成对象实体
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json字符串(eg.{"ID":"112","Name":"石子儿"})</param>
/// <returns>对象实体</returns>
public static T DeserializeJsonToObject<T>(string json) where T : class
{
try
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
......@@ -34,65 +45,71 @@ namespace OnlineStore.Common
T t = o as T;
return t;
}
/// <summary>
/// 解析JSON数组生成对象实体集合
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json数组字符串(eg.[{"ID":"112","Name":"石子儿"}])</param>
/// <returns>对象实体集合</returns>
public static List<T> DeserializeJsonToList<T>(string json) where T : class
catch (Exception ex)
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(List<T>));
List<T> list = o as List<T>;
return list;
LogUtil.error(" JsonHelper.DeserializeJsonToObject error【" + json + "】" + ex);
}
return null;
}
/// <summary>
/// 反序列化JSON到给定的匿名对象.
/// </summary>
/// <typeparam name="T">匿名对象类型</typeparam>
/// <param name="json">json字符串</param>
/// <param name="anonymousTypeObject">匿名对象</param>
/// <returns>匿名对象</returns>
public static T DeserializeAnonymousType<T>(string json, T anonymousTypeObject)
{
T t = JsonConvert.DeserializeAnonymousType(json, anonymousTypeObject);
return t;
}
/// <summary>
/// 解析JSON数组生成对象实体集合
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json数组字符串(eg.[{"ID":"112","Name":"石子儿"}])</param>
/// <returns>对象实体集合</returns>
public static List<T> DeserializeJsonToList<T>(string json) where T : class
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(List<T>));
List<T> list = o as List<T>;
return list;
}
///// <summary>
///// 与服务器通信用对象
///// </summary>
//public class Operation
//{
// private string _cid = "";
// public string cid
// {
// get { return _cid; }
// set { _cid = value; }
// }
// public int seq { get; set; }
// public int op { get; set; }
// public int status { get; set; }
/// <summary>
/// 反序列化JSON到给定的匿名对象.
/// </summary>
/// <typeparam name="T">匿名对象类型</typeparam>
/// <param name="json">json字符串</param>
/// <param name="anonymousTypeObject">匿名对象</param>
/// <returns>匿名对象</returns>
public static T DeserializeAnonymousType<T>(string json, T anonymousTypeObject)
{
T t = JsonConvert.DeserializeAnonymousType(json, anonymousTypeObject);
return t;
}
}
///// <summary>
///// 与服务器通信用对象
///// </summary>
//public class Operation
//{
// private string _cid = "";
// public string cid
// {
// get { return _cid; }
// set { _cid = value; }
// }
// public int seq { get; set; }
// public int op { get; set; }
// public int status { get; set; }
// private string _error = "";
// public string error
// {
// get { return _error; }
// set { _error = value; }
// }
// private Dictionary<string, string> _data = new Dictionary<string,string>();
// public Dictionary<string, string> data {
// get { return _data; }
// set { _data = value; }
// }
// private string _error = "";
// public string error
// {
// get { return _error; }
// set { _error = value; }
// }
// private Dictionary<string, string> _data = new Dictionary<string,string>();
// public Dictionary<string, string> data {
// get { return _data; }
// set { _data = value; }
// }
//}
//}
}
}
\ No newline at end of file
......@@ -135,6 +135,7 @@ namespace OnlineStore.Common
//logBox.SelectionColor = color;
System.DateTime now = System.DateTime.Now;
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine);
logBox.ScrollToCaret();
count++;
}
......
......@@ -56,6 +56,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......
......@@ -173,7 +173,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeCount, GetCodeParamFilePath(codeType), codeType);
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, 2000);
}
foreach (CodeInfo c in cc)
{
......@@ -189,7 +189,7 @@ namespace OnlineStore.DeviceLibrary
{
// SaveImageToFile(deviceName, cameraName, bit);
}
LogUtil.info( " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】 :" + r);
LogUtil.info(" 【" + cameraName + "】" + " 扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】 :" + r);
}
catch (AccessViolationException e)
{
......@@ -294,18 +294,5 @@ namespace OnlineStore.DeviceLibrary
{
return Regex.IsMatch(str, @"[\u4e00-\u9fa5]");
}
public static string ProcessCode(List<string> codeList)
{
string code = "";
foreach (string cc in codeList)
{
if (string.IsNullOrEmpty(cc))
{
continue;
}
code += cc + "##";
}
return ReplaceCode(code);
}
}
}
......@@ -50,15 +50,15 @@ AXIS,(轴四)压紧轴,Comp_Axis,3,HC,0,,,,,
AXIS,(轴五)批量上下料轴,Batch_Axis,4,HC,0,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,升降轴 仓门位置P7(人工拿走盘的位置),UpDownAxis_Door_P7,343100,,,,,,,
PRO,升降轴 出库高点P2,UpDownAxis_OutHigh_P2,231250,,,,,,,
PRO,升降轴 出库低点P8,UpDownAxis_OutLow_P8,214900,,,,,,,
PRO,升降轴从吸盘下方接料后下降的高度,UpDownAxis_DownValue,10000,,,,,,,
PRO,升降轴 入库P1点集合,UpDownAxis_P1_List,8#393356;12#387000;16#387700;20#385000;24#381620;28#381620;32#381620;36#375200;40#375200;48#375200;52#375200;75#375200;,,,,,,,
PRO,旋转轴(轴一)P1 待机原位点,MiddleAxis_P1_Position,245700,,,,,,,
PRO,进出轴(轴三)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,,
PRO,压紧轴(轴四)P1待机原位点,CompressAxis_P1_Position,24900,,,,,,,
PRO,压紧轴(轴四)P2压紧点集合,CompressAxis_P2_List,8#417100;12#380400;16#370000;20#330000;24#319450;28#300000;32#200000;36#200000;40#200000;44#200000;48#196500;52#24900;75#24900;81#314421;,,,,,,,
PRO,升降轴 仓门位置P7(人工拿走盘的位置),UpDownAxis_Door_P7,3473,,,,,,,
PRO,升降轴 出库高点P2,UpDownAxis_OutHigh_P2,2276,,,,,,,
PRO,升降轴 出库低点P8,UpDownAxis_OutLow_P8,2113,,,,,,,
PRO,升降轴从吸盘下方接料后下降的高度,UpDownAxis_DownValue,100,,,,,,,
PRO,升降轴 入库P1点集合,UpDownAxis_P1_List,8#3926;12#3884;16#3840;20#3800;24#3759;,,,,,,,
PRO,旋转轴(轴一)P1 待机原位点,MiddleAxis_P1_Position,3060,,,,,,,
PRO,进出轴(轴三)P1待机原位点,InOutAxis_P1_Position,100,,,,,,,
PRO,压紧轴(轴四)P1待机原位点,CompressAxis_P1_Position,7000,,,,,,,
PRO,压紧轴(轴四)P2压紧点集合,CompressAxis_P2_List,8#42835;12#38557;16#34550;20#30540;24#26030;,,,,,,,
PRO,是否使用定位气缸,IsHasLocationCylinder,0,,,,,,,
PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,,
PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,,,,
......@@ -68,25 +68,24 @@ PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,180,,,,,,,
,,,,,,,,,,
PRO,预警温度,WarnTemperate,80,,,,,,,
PRO,预警湿度,WarnHumidity,80,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,500,,,,,,,
PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,1000,,,,,,,
PRO,(轴一)旋转轴减速度,MiddleAxis_DelSpeed,1000,,,,,,,
PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,30,,,,,,,
PRO,(轴一)旋转轴原点高速,MiddleAxis_HomeHighSpeed,250,,,,,,,
PRO,(轴一)旋转轴原点加速度,MiddleAxis_HomeAddSpeed,3000,,,,,,,
PRO,(轴二)升降轴轴目标速度,UpdownAxis_TargetSpeed,200,,,,,,,
PRO,(轴二)升降轴轴加速度,UpdownAxis_AddSpeed,800,,,,,,,
PRO,(轴二)升降轴轴减速度,UpdownAxis_DelSpeed,800,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,100,,,,,,,
PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,400,,,,,,,
PRO,(轴一)旋转轴减速度,MiddleAxis_DelSpeed,400,,,,,,,
PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,90,,,,,,,
PRO,(轴一)旋转轴原点高速,MiddleAxis_HomeHighSpeed,100,,,,,,,
PRO,(轴一)旋转轴原点加速度,MiddleAxis_HomeAddSpeed,500,,,,,,,
PRO,(轴二)升降轴轴目标速度,UpdownAxis_TargetSpeed,400,,,,,,,
PRO,(轴二)升降轴轴加速度,UpdownAxis_AddSpeed,1200,,,,,,,
PRO,(轴二)升降轴轴减速度,UpdownAxis_DelSpeed,1200,,,,,,,
PRO,(轴二)升降轴轴原点低速度,UpdownAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴二)升降轴轴原点高速,UpdownAxis_HomeHighSpeed,250,,,,,,,
PRO,(轴二)升降轴轴原点加速度,UpdownAxis_HomeAddSpeed,3000,,,,,,,
PRO,(轴三)进出轴目标速度,InoutAxis_TargetSpeed,5000,,,,,,,
PRO,(轴三)进出轴目标速度,InoutAxis_TargetSpeed,1000,,,,,,,
PRO,(轴三)进出轴加速度,InoutAxis_AddSpeed,5000,,,,,,,
PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,5000,,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,200,,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,800,,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,5000,,,,,,,
PRO,升降轴(轴二)到仓门速度,UpDownAxis_Door_Speed,500,,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,80,,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,200,,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,3000,,,,,,,
PRO,升降轴(轴二)P1速度,UpDownAxis_P1_Speed,2000,,,,,,,
PRO,升降轴(轴二)P2速度,UpDownAxis_P2_Speed,2000,,,,,,,
PRO,升降轴(轴二)P3速度,UpDownAxis_P3_Speed,2000,,,,,,,
......@@ -97,15 +96,15 @@ PRO,升降轴(轴二)到仓门P7速度,UpDownAxis_P7_Speed,2000,,,,,,,
PRO,升降轴(轴二)P8速度,UpDownAxis_P8_Speed,100,,,,,,,
PRO,旋转轴(轴一)P1速度,MiddleAxis_P1_Speed,800,,,,,,,
PRO,旋转轴(轴一)P2速度,MiddleAxis_P2_Speed,800,,,,,,,
PRO,进出轴(轴三)P1速度,InOutAxis_P1_Speed,600,,,,,,,
PRO,进出轴(轴三)P2速度,InOutAxis_P2_Speed,300,,,,,,,
PRO,进出轴(轴三)P3速度,InOutAxis_P3_Speed,300,,,,,, ,
PRO,(轴一)旋转轴最小误差脉冲值,MiddleAxis_ErrorCountMin,10,,,,,,,
PRO,(轴二)升降轴轴最小误差脉冲值,UpdownAxis_ErrorCountMin,10,,,,,,,
PRO,(轴三)进出轴最小误差脉冲值,InoutAxis_ErrorCountMin,10,,,,,,,
PRO,(轴一)旋转轴最大误差脉冲值,MiddleAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴二)升降轴轴最大误差脉冲值,UpdownAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴三)进出轴最大误差脉冲值,InoutAxis_ErrorCountMax,1000,,,,,,,
PRO,进出轴(轴三)P1速度,InOutAxis_P1_Speed,1200,,,,,,,
PRO,进出轴(轴三)P2速度,InOutAxis_P2_Speed,1600,,,,,,,
PRO,进出轴(轴三)P3速度,InOutAxis_P3_Speed,1600,,,,,, ,
PRO,(轴一)旋转轴最小误差脉冲值,MiddleAxis_ErrorCountMin,5,,,,,,,
PRO,(轴二)升降轴轴最小误差脉冲值,UpdownAxis_ErrorCountMin,5,,,,,,,
PRO,(轴三)进出轴最小误差脉冲值,InoutAxis_ErrorCountMin,5,,,,,,,
PRO,(轴一)旋转轴最大误差脉冲值,MiddleAxis_ErrorCountMax,20,,,,,,,
PRO,(轴二)升降轴轴最大误差脉冲值,UpdownAxis_ErrorCountMax,20,,,,,,,
PRO,(轴三)进出轴最大误差脉冲值,InoutAxis_ErrorCountMax,20,,,,,,,
PRO,出入库多少次,会自动重置旋转轴,Box_ResetMCount,1000,,,,,,,
PRO,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,,, ,
PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,
......@@ -124,37 +123,37 @@ PRO,温湿度端口号,Humiture_Port,COM5,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,200,,,,,,,
PRO,(轴五)上料轴慢速匀速上升速度,BatchAxis_SlowSpeed,200,,,,,,,
PRO,(轴五)上料轴加速度,BatchAxis_AddSpeed,4000,,,,,,,
PRO,(轴五)上料轴减速度,BatchAxis_DelSpeed,4000,,,,,,,
PRO,(轴五)上料轴原点低速,BatchAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴五)上料轴原点高速,BatchAxis_HomeHighSpeed,80,,,,,,,
PRO,(轴五)上料轴原点加速度,BatchAxis_HomeAddSpeed,2000,,,,,, ,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,1610000,,,,,, ,
PRO,(轴五)上料轴P2点(待机点),BatchAxis_P2,10000,,,,,,,
PRO,(轴五)上料轴P2速度,BatchAxis_P2_Speed,1000,,,,,,,
PRO,(轴五)上料轴最小误差脉冲值,BatchAxis_ErrorCountMin,10,,,,,,,
PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,20000,,,,,,,
PRO,(轴五)上料轴慢速匀速上升速度,BatchAxis_SlowSpeed,10000,,,,,,,
PRO,(轴五)上料轴加速度,BatchAxis_AddSpeed,60000,,,,,,,
PRO,(轴五)上料轴减速度,BatchAxis_DelSpeed,60000,,,,,,,
PRO,(轴五)上料轴原点低速,BatchAxis_HomeLowSpeed,20000,,,,,,,
PRO,(轴五)上料轴原点高速,BatchAxis_HomeHighSpeed,30000,,,,,,,
PRO,(轴五)上料轴原点加速度,BatchAxis_HomeAddSpeed,90000,,,,,, ,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,290669,,,,,, ,
PRO,(轴五)上料轴P2点(待机点),BatchAxis_P2,3000,,,,,,,
PRO,(轴五)上料轴P2速度,BatchAxis_P2_Speed,15000,,,,,,,
PRO,(轴五)上料轴最小误差脉冲值,BatchAxis_ErrorCountMin,100,,,,,,,
PRO,(轴五)上料轴最大误差脉冲值,BatchAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,,
PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴出料时距离检测信号需要下降的高度,BatchAxis_OutDownPosition,30000,,,,,,,
PRO,(轴五)上料轴出料时检测到料盘需要下降的高度,BatchAxis_DownPosition2,150000,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,2000,,,,,,,
PRO,(轴五)上料轴出料时距离检测信号需要下降的高度,BatchAxis_OutDownPosition,10,,,,,,,
PRO,(轴五)上料轴出料时检测到料盘需要下降的高度,BatchAxis_DownPosition2,3000,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,20000,,,,,,,
PRO,(轴五)上料轴最最大料盘高度,到达后无法批量出库,BatchAxis_MaxHeight,250,,,,,,,
PRO,最后一盘料需要补充的高度,LastTrayAddHeight,7,,,,,,,
PRO,(轴五)上料轴P3点(上料目标位置),BatchAxis_P3,1724717,,,,,,,
PRO,(轴五)上料轴P3点(上料目标位置),BatchAxis_P3,362062,,,,,,,
,,,,,,,,,,
PRO,(轴二)升降轴单盘入库抬升料盘的高度,UpdownAxis_UpPosition,1000,,,,,,,
PRO,(轴五)上料轴出库上升最大高度,BatchAxis_OutMaxValue,1491390,,,,,,,
PRO,(轴二)升降轴单盘入库抬升料盘的高度,UpdownAxis_UpPosition,100,,,,,,,
PRO,(轴五)上料轴出库上升最大高度,BatchAxis_OutMaxValue,100,,,,,,,
,,,,,,,,,,
PRO,(轴四)压紧轴目标速度,CompAxis_TargetSpeed,30000,,,,,,,
PRO,(轴四)压紧轴加速度,CompAxis_AddSpeed,15000,,,,,,,
PRO,(轴四)压紧轴减速度,CompAxis_DelSpeed,15000,,,,,,,
PRO,(轴四)压紧轴目标速度,CompAxis_TargetSpeed,10000,,,,,,,
PRO,(轴四)压紧轴加速度,CompAxis_AddSpeed,25000,,,,,,,
PRO,(轴四)压紧轴减速度,CompAxis_DelSpeed,25000,,,,,,,
PRO,(轴四)压紧轴原点低速,CompAxis_HomeLowSpeed,3000,,,,,,,
PRO,(轴四)压紧轴原点高速,CompAxis_HomeHighSpeed,5000,,,,,,,
PRO,(轴四)压紧轴原点加速度,CompAxis_HomeAddSpeed,10000,,,,,,,
PRO,(轴四)压紧轴P1速度,CompAxis_P1_Speed,1100,,,,,,,
PRO,(轴四)压紧轴P2速度,CompAxis_P2_Speed,1100,,,,,,,
PRO,(轴四)压紧轴P3速度,CompAxis_P3_Speed,1100,,,,,,,
PRO,(轴四)压紧轴P1速度,CompAxis_P1_Speed,3000,,,,,,,
PRO,(轴四)压紧轴P2速度,CompAxis_P2_Speed,7500,,,,,,,
PRO,(轴四)压紧轴P3速度,CompAxis_P3_Speed,7500,,,,,,,
PRO,特殊二维码尺寸配置,CodeSizeConfig,T;PartNum;1=330x81,,,,,,,
......@@ -113,7 +113,7 @@ namespace OnlineStore.DeviceLibrary
return true;
}
}
private DateTime preRWTime = DateTime.Now;
private void CheckWait()
{
List<WaitResultInfo> list = StoreMove.WaitList;
......@@ -169,16 +169,29 @@ namespace OnlineStore.DeviceLibrary
{
timeOutMs = 650000;
}
//if (!wait.IsEnd && span.TotalSeconds > 2 && wait.IoType.Equals(IO_Type.SuckingDisc_Air))
//{
// string ioType = IO_Type.SuckingDisc_Work;
// IO_VALUE doValue = IOManager.DOValue(ioType);
// if (!doValue.Equals(wait.IoValue))
// {
// LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + ioType + "=" + wait.IoValue + ")");
// IOManager.IOMove(ioType, wait.IoValue);
// }
//}
TimeSpan rwSpan = DateTime.Now - preRWTime;
if (wait.IsEnd.Equals(false) && rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < 30 && Config.DOList.ContainsKey(wait.IoType))
{
preRWTime = DateTime.Now;
string msg = " [" + StoreMove.MoveType + "][" + StoreMove.MoveStep + "] " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds, 1) + "秒,重写DO:";
bool isLog = false;
foreach (WaitResultInfo ww in list)
{
if (ww != null && ww.WaitType.Equals(2) && Config.DOList.ContainsKey(ww.IoType))
{
if (IOManager.DOValue(ww.IoType).Equals(ww.IoValue).Equals(false))
{
isLog = true;
IOManager.IOMove(ww.IoType, ww.IoValue);
msg += ww.ToStr() + ",";
}
}
}
if (isLog)
{
LogUtil.error(StoreName + msg);
}
}
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
......@@ -253,12 +266,12 @@ namespace OnlineStore.DeviceLibrary
}
else if (span.TotalSeconds > StoreMove.TimeOutSeconds)
{
//string msg = string.Format(ResourceControl.GetString(ResourceControl.MoveTimeOut), "[" + StoreMove.MoveStep + "]" ,
// "[" + NotOkMsg + "]","[" + Math.Round(span.TotalSeconds, 1) + "]");
string msg = ResourceControl.MoveTimeOut+ "[" + StoreMove.MoveStep + "]"+ $"[{((Wait_Type)waitType).ToString()}]"+
"[" + NotOkMsg + "]"+ "[" + Math.Round(span.TotalSeconds, 1) + "]";
string p1 = "[" + StoreMove.MoveStep + "]";
string p2 = "[" + NotOkMsg + "]";
string p3 = "[" + Math.Round(span.TotalSeconds, 1) + "]";
string msg = ResourceControl.GetString(ResourceControl.MoveTimeOut, p1 + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + p2 + p3, p1, p2, p3);
string newType = ResourceControl.MoveTimeOut;
SetWaitWarnMsg(msg, newType, StoreMove.MoveStep + "", Math.Round(span.TotalSeconds, 1) + "");
SetWaitWarnMsg(msg, newType, p1, p2, p3);
LogUtil.error(WarnObj.WarnMsg, 15);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnObj.WarnMsg, StoreMove.MoveType);
}
......@@ -557,8 +570,8 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_14_GoBack)
{
{
preProTime = DateTime.Now.AddSeconds(-5);
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, " 【" + posId + "】 入库结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!");
StoreMove.EndMove();
......@@ -696,9 +709,9 @@ namespace OnlineStore.DeviceLibrary
InStoreLog("入库:SIS_38 ,清理扫码信息,开始扫码,最多等待6000 ");
AutomaticBaiting.ClearInStoreInfo();
StoreMove.NextMoveStep(StoreMoveStep.SIS_38_ScanCode);
StoreMove.OneWaitCanEndStep = true;
StoreMove.WaitList.Add(WaitResultInfo.WaitCodeOK());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(6000));
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(9000));
StoreMove.OneWaitCanEndStep = true;
AutomaticBaiting.GetCameraCode();
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_38_ScanCode))
......
......@@ -376,8 +376,9 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I06_SuckingDisc_Up);
InStoreLog(" 吸盘上升");
CylinderMove(IO_Type.ClampingDisc_Up, IO_Type.ClampingDisc_Down, false);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampingDisc_Down, IO_VALUE.LOW));
//CylinderMove(IO_Type.ClampingDisc_Up, IO_Type.ClampingDisc_Down, false);
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampingDisc_Down, IO_VALUE.LOW));
CylinderMove(IO_Type.ClampingDisc_Up, IO_Type.ClampingDisc_Down, true);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
......@@ -479,7 +480,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(Name + StoreMove.MoveStep + "入料: 从服务器获取入库PosId,尺寸:【" + LastWidth + "*" + LastHeight + "】二维码【" + LastCode + "】");
GetInStorePosId(ProcessMsg());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(3000));
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(5000));
}
}
else if (span.TotalSeconds > 60)
......@@ -514,6 +515,7 @@ namespace OnlineStore.DeviceLibrary
else
{
InStoreLog(" 入库失败,尺寸:【" + LastWidth + "*" + LastHeight + "】将料盘送出,等待料盘拿走");
StoreManager.cancelPutInTask(LastSendCode);
SendTrayOut();
}
}
......@@ -637,8 +639,8 @@ namespace OnlineStore.DeviceLibrary
if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I03_ScanCode);
InStoreLog(" 开始扫码,最多等待10000 ");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(10000));
InStoreLog(" 开始扫码,最多等待9000 ");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(9000));
StoreMove.WaitList.Add(WaitResultInfo.WaitCodeOK());
StoreMove.OneWaitCanEndStep = true;
GetCameraCode();
......
......@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Text;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
......@@ -14,22 +14,24 @@ namespace OnlineStore.DeviceLibrary
public class StoreManager
{
public static bool HasDisableDoorControl = ConfigAppSettings.GetIntValue(Setting_Init.HasDisableDoorControl).Equals(1);
private static string api_communication = "service/store/communication"; //流水线状态通信接口
//private static string api_nextFeeder = "service/store/nextFeeder"; // 出库站位列表切换接口
public static string api_inventory = "rest/api/v2/mes/inventory";//获取单个或全总SMD-BOX 中的实时库存信息
public static string api_stackOut = "rest/api/v2/mes/stackOut";//本接⼜提供物料出库功能,可⼀次性出单/多盘物料
// 取消任务地址: /cancelPutInTask //参数: barcode
private static string Addr_cancelPutInTask = "service/store/cancelPutInTask";
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static AC_SA_BoxBean Store = null;
public static AUTO_SA_Config Config = null;
private static bool isInit = false;
public static bool IsConnectServer=!ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
public StoreManager()
{
}
}
public static void CheckEnum(Type type)
{
if (type.IsEnum)
......@@ -71,7 +73,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, "配置的料仓 类型=" + storeType + ",开始加载料仓配置");
if (storeType == StoreType.AUTO_SA_Config)
{
string appPath = Application.StartupPath;
string appPath = Application.StartupPath;
string CID = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
string linefilePath = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_ConfigPath);
......@@ -86,7 +88,7 @@ namespace OnlineStore.DeviceLibrary
Config = (AUTO_SA_Config)storeConfig;
Store = new AC_SA_BoxBean(Config);
Store.CID = CID;
LogUtil.info(LOGGER, "加载料仓完成!");
LogUtil.info(LOGGER, "加载料仓完成!");
return Store;
}
}
......@@ -99,10 +101,6 @@ namespace OnlineStore.DeviceLibrary
}
return Store;
}
/// <summary>
/// 修改了料仓配置,更新缓存,更新配置文件(只能更新PRO的配置)
/// </summary>
/// <param name="kTK_LA_Store_Config"></param>
public static void UpdateBoxConfig(AUTO_SA_Config storeConfig)
{
try
......@@ -125,15 +123,26 @@ namespace OnlineStore.DeviceLibrary
}
}
public static string GetPostApi(string host)
{
{
host = GetHostUrl(host);
return host + api_communication;
}
public static string GetAPI(string host, string api)
public static string GetAPI(string api, Dictionary<string, string> paramsMap = null)
{
host = GetHostUrl(host);
return host + api;
string host = GetHostUrl("");
if (paramsMap == null || paramsMap.Count <= 0)
{
return host + api;
}
string path = host + api.Trim() + "?";
foreach (string paramName in paramsMap.Keys)
{
string par = System.Web.HttpUtility.UrlEncode(paramsMap[paramName], System.Text.Encoding.UTF8);
path += paramName + "=" + par + "&";
}
path = path.Substring(0, path.Length - 1);
return path;
}
private static string GetHostUrl(string host)
......@@ -152,7 +161,51 @@ namespace OnlineStore.DeviceLibrary
}
return host;
}
public static string GetAllAxisPos() {
public static string cancelPutInTask(string barcode)
{
string msg = "";
try
{
string serverAddr = ConfigAppSettings.GetValue(Setting_Init.http_server);
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error("cancelPutInTask [" + barcode + "] :未找到服务器地址");
return msg;
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode);
string server = GetAPI(Addr_cancelPutInTask, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("cancelPutInTask " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
//【http://192.168.21.62/myproject/service/store/cancelPutInTask?barcode=%3d1%2b0x0-7x8%3dIAC%3b6010A0243701%3b2031%3bNA%3b4000%3bVBR20BP02341%3b%23%23】
//【{"code":0,"msg":"ok","data":true}】
ReviceData data = JsonHelper.DeserializeJsonToObject<ReviceData>(resultStr);
if (data == null)
{
return msg = " cancelPutInTask【 " + barcode + "】 没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
{
return msg = " cancelPutInTask【 " + barcode + "】 :" + data.msg;
}
return "";
}
catch (Exception ex)
{
LogUtil.error(" " + ex.ToString());
}
return msg;
}
public static string GetAllAxisPos()
{
int UpDown_AxisP = AxisManager.instance.GetActualtPosition(Config.UpDown_Axis);
int Batch_AxisP = AxisManager.instance.GetActualtPosition(Config.Batch_Axis);
int Comp_AxisP = AxisManager.instance.GetActualtPosition(Config.Comp_Axis);
......@@ -162,14 +215,23 @@ namespace OnlineStore.DeviceLibrary
}
}
public class ReviceData
{
//{"code":0,"msg":"ok","data":"7"}
public int code { get; set; }
public string msg { get; set; }
public object data { get; set; }
}
public class APIInfo
{
//[{"LOC":"1","RI":"A100007","QTY":1000,"PN":"pn"},{"LOC":"2","RI":"A100015","QTY":1000,"PN":"pn"}]
public int LOC=1;
public string RI = "";
public int LOC = 1;
public string RI = "";
public string QTY = "";
public string PN = "";
}
}
}
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!