Commit de4786e7 LN

1.DO增加重写功能,状态发送完成再获取库位号。2.升降气缸到位后批量轴再运动。3.报警文字bug修改。4.入库失败时调用取消任务

1 个父辈 007d9f74
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio Version 16
VisualStudioVersion = 15.0.27130.2024 VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACServoDriveTest", "source\ACServoDriveTest\ACServoDriveTest.csproj", "{7FA84E1E-BCDE-49F6-BE42-0BC397AF65B8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACServoDriveTest", "source\ACServoDriveTest\ACServoDriveTest.csproj", "{7FA84E1E-BCDE-49F6-BE42-0BC397AF65B8}"
EndProject EndProject
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<!--是否有门禁屏蔽功能,=1表示有此功能--> <!--是否有门禁屏蔽功能,=1表示有此功能-->
<add key="HasDisableDoorControl" value="1" /> <add key="HasDisableDoorControl" value="1" />
<add key="ACBaudRate" value="115200" /> <add key="ACBaudRate" value="115200" />
<add key="Default_Language" value="ja-JP" /> <add key="Default_Language" value="zh-CN" />
<add key="UseAIOBOX" value="1" /> <add key="UseAIOBOX" value="1" />
<add key="DIMS" value="20" /> <add key="DIMS" value="20" />
<add key="DOMS" value="200" /> <add key="DOMS" value="200" />
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(141, 17); this.label1.Size = new System.Drawing.Size(141, 17);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "(轴)旋转轴"; this.label1.Text = "(轴1)旋转轴";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// label2 // label2
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(141, 17); this.label2.Size = new System.Drawing.Size(141, 17);
this.label2.TabIndex = 1; this.label2.TabIndex = 1;
this.label2.Text = "(轴)升降轴"; this.label2.Text = "(轴2)升降轴";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// label3 // label3
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(141, 17); this.label3.Size = new System.Drawing.Size(141, 17);
this.label3.TabIndex = 2; this.label3.TabIndex = 2;
this.label3.Text = "(轴)进出轴"; this.label3.Text = "(轴3)进出轴";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// btnMiddleMove // btnMiddleMove
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(141, 17); this.label4.Size = new System.Drawing.Size(141, 17);
this.label4.TabIndex = 22; this.label4.TabIndex = 22;
this.label4.Text = "(轴)压紧轴"; this.label4.Text = "(轴4)压紧轴";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// txtAutoPosition // txtAutoPosition
...@@ -404,7 +404,7 @@ ...@@ -404,7 +404,7 @@
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "FrmAxisDebug"; this.Name = "FrmAxisDebug";
this.Text = "轴点动调试"; this.Text = "运动轴调试";
this.Load += new System.EventHandler(this.FrmAxisDebug_Load); this.Load += new System.EventHandler(this.FrmAxisDebug_Load);
this.Shown += new System.EventHandler(this.FrmAxisDebug_Shown); this.Shown += new System.EventHandler(this.FrmAxisDebug_Shown);
((System.ComponentModel.ISupportInitialize)(this.picAxis)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picAxis)).EndInit();
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
this.groupBox1.Size = new System.Drawing.Size(456, 608); this.groupBox1.Size = new System.Drawing.Size(456, 608);
this.groupBox1.TabIndex = 105; this.groupBox1.TabIndex = 105;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "DO写入"; this.groupBox1.Text = "IO状态修改";
// //
// btnCloseDeviceLed // btnCloseDeviceLed
// //
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
this.btnDisDoorClose.Name = "btnDisDoorClose"; this.btnDisDoorClose.Name = "btnDisDoorClose";
this.btnDisDoorClose.Size = new System.Drawing.Size(135, 52); this.btnDisDoorClose.Size = new System.Drawing.Size(135, 52);
this.btnDisDoorClose.TabIndex = 268; this.btnDisDoorClose.TabIndex = 268;
this.btnDisDoorClose.Text = "激活电气维护门警报"; this.btnDisDoorClose.Text = "激活维护门警报";
this.btnDisDoorClose.UseVisualStyleBackColor = true; this.btnDisDoorClose.UseVisualStyleBackColor = true;
this.btnDisDoorClose.Click += new System.EventHandler(this.btnDisDoorClose_Click); this.btnDisDoorClose.Click += new System.EventHandler(this.btnDisDoorClose_Click);
// //
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
this.btnDisDoorOpen.Name = "btnDisDoorOpen"; this.btnDisDoorOpen.Name = "btnDisDoorOpen";
this.btnDisDoorOpen.Size = new System.Drawing.Size(135, 52); this.btnDisDoorOpen.Size = new System.Drawing.Size(135, 52);
this.btnDisDoorOpen.TabIndex = 267; this.btnDisDoorOpen.TabIndex = 267;
this.btnDisDoorOpen.Text = "关闭电气维护门警报"; this.btnDisDoorOpen.Text = "关闭维护门警报";
this.btnDisDoorOpen.UseVisualStyleBackColor = true; this.btnDisDoorOpen.UseVisualStyleBackColor = true;
this.btnDisDoorOpen.Click += new System.EventHandler(this.btnDisDoorOpen_Click); this.btnDisDoorOpen.Click += new System.EventHandler(this.btnDisDoorOpen_Click);
// //
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
this.button5.Name = "button5"; this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(135, 52); this.button5.Size = new System.Drawing.Size(135, 52);
this.button5.TabIndex = 265; this.button5.TabIndex = 265;
this.button5.Text = "打开进气口"; this.button5.Text = "开启进气口";
this.button5.UseVisualStyleBackColor = true; this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click); this.button5.Click += new System.EventHandler(this.button5_Click);
// //
...@@ -277,7 +277,7 @@ ...@@ -277,7 +277,7 @@
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(104, 32); this.label3.Size = new System.Drawing.Size(104, 32);
this.label3.TabIndex = 247; this.label3.TabIndex = 247;
this.label3.Text = "选择:"; this.label3.Text = "端口:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// btnOpenLed // btnOpenLed
...@@ -384,7 +384,7 @@ ...@@ -384,7 +384,7 @@
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(103, 30); this.label5.Size = new System.Drawing.Size(103, 30);
this.label5.TabIndex = 237; this.label5.TabIndex = 237;
this.label5.Text = "保持(ms):"; this.label5.Text = "保持时间(ms):";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// cmbWriteIO // cmbWriteIO
......
...@@ -255,6 +255,7 @@ namespace OnlineStore.AutoInOutStore ...@@ -255,6 +255,7 @@ namespace OnlineStore.AutoInOutStore
LanguageProcess(); LanguageProcess();
SetImage(); SetImage();
} }
private void SetImage() private void SetImage()
{ {
...@@ -1557,10 +1558,13 @@ namespace OnlineStore.AutoInOutStore ...@@ -1557,10 +1558,13 @@ namespace OnlineStore.AutoInOutStore
ConfigAppSettings.SaveValue(Setting_Init.DebugPosId, poText); ConfigAppSettings.SaveValue(Setting_Init.DebugPosId, poText);
store.autoMsg =ResourceCulture.GetString("自动出入库", "自动出入库")+ ":" + poText; store.autoMsg =ResourceCulture.GetString("自动出入库", "自动出入库")+ ":" + poText;
store.autoNext = true; store.autoNext = true;
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ""); LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + "");
btnStart.Text = StopAuto; btnStart.Text = StopAuto;
DebugStatus(false); DebugStatus(false);
string msg = AutomaticBaiting.doStartBatchIn();
LogUtil.info("自动出入库: 开始自动入库:库位号【" + poText + "】,开始入库,结果:" + msg);
} }
} }
} }
......
...@@ -19,7 +19,7 @@ namespace OnlineStore.AutoInOutStore ...@@ -19,7 +19,7 @@ namespace OnlineStore.AutoInOutStore
{ {
public class ResourceCulture public class ResourceCulture
{ {
public static bool ShowLog = true ; public static bool ShowLog = false ;
public static string China = "zh-CN"; public static string China = "zh-CN";
public static string English = "en-US"; public static string English = "en-US";
public static string German = "ge-DE"; public static string German = "ge-DE";
......
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
this.groupBox6.Size = new System.Drawing.Size(962, 464); this.groupBox6.Size = new System.Drawing.Size(962, 464);
this.groupBox6.TabIndex = 250; this.groupBox6.TabIndex = 250;
this.groupBox6.TabStop = false; this.groupBox6.TabStop = false;
this.groupBox6.Text = "伺服运动测试";
// //
// groupBox2 // groupBox2
// //
...@@ -258,7 +259,7 @@ ...@@ -258,7 +259,7 @@
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(171, 33); this.label3.Size = new System.Drawing.Size(171, 33);
this.label3.TabIndex = 277; this.label3.TabIndex = 277;
this.label3.Text = "保存文件名称:"; this.label3.Text = "位置文件名称:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// txtPosition // txtPosition
...@@ -350,7 +351,7 @@ ...@@ -350,7 +351,7 @@
this.btnHomeMove.Name = "btnHomeMove"; this.btnHomeMove.Name = "btnHomeMove";
this.btnHomeMove.Size = new System.Drawing.Size(132, 36); this.btnHomeMove.Size = new System.Drawing.Size(132, 36);
this.btnHomeMove.TabIndex = 110; this.btnHomeMove.TabIndex = 110;
this.btnHomeMove.Text = "原点返回"; this.btnHomeMove.Text = "返回原点";
this.btnHomeMove.UseVisualStyleBackColor = true; this.btnHomeMove.UseVisualStyleBackColor = true;
this.btnHomeMove.Click += new System.EventHandler(this.btnHomeMove_Click); this.btnHomeMove.Click += new System.EventHandler(this.btnHomeMove_Click);
// //
...@@ -361,7 +362,7 @@ ...@@ -361,7 +362,7 @@
this.btnServoOn.Name = "btnServoOn"; this.btnServoOn.Name = "btnServoOn";
this.btnServoOn.Size = new System.Drawing.Size(132, 36); this.btnServoOn.Size = new System.Drawing.Size(132, 36);
this.btnServoOn.TabIndex = 258; this.btnServoOn.TabIndex = 258;
this.btnServoOn.Text = "打开伺服"; this.btnServoOn.Text = "打开";
this.btnServoOn.UseVisualStyleBackColor = true; this.btnServoOn.UseVisualStyleBackColor = true;
this.btnServoOn.Click += new System.EventHandler(this.btnServoOn_Click); this.btnServoOn.Click += new System.EventHandler(this.btnServoOn_Click);
// //
...@@ -383,7 +384,7 @@ ...@@ -383,7 +384,7 @@
this.btnServoOff.Name = "btnServoOff"; this.btnServoOff.Name = "btnServoOff";
this.btnServoOff.Size = new System.Drawing.Size(132, 36); this.btnServoOff.Size = new System.Drawing.Size(132, 36);
this.btnServoOff.TabIndex = 259; this.btnServoOff.TabIndex = 259;
this.btnServoOff.Text = "关闭伺服"; this.btnServoOff.Text = "关闭";
this.btnServoOff.UseVisualStyleBackColor = true; this.btnServoOff.UseVisualStyleBackColor = true;
this.btnServoOff.Click += new System.EventHandler(this.btnServoOff_Click); this.btnServoOff.Click += new System.EventHandler(this.btnServoOff_Click);
// //
...@@ -537,7 +538,7 @@ ...@@ -537,7 +538,7 @@
this.Controls.Add(this.groupBox6); this.Controls.Add(this.groupBox6);
this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "FrmPositionTool"; this.Name = "FrmPositionTool";
this.Text = "升降轴位置测试"; this.Text = "轴2测试";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmPositionTool_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmPositionTool_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
this.Shown += new System.EventHandler(this.FrmPositionTool_Shown); this.Shown += new System.EventHandler(this.FrmPositionTool_Shown);
......
...@@ -17,20 +17,9 @@ namespace OnlineStore.Common ...@@ -17,20 +17,9 @@ namespace OnlineStore.Common
{ {
public class HttpHelper public class HttpHelper
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData)
{ public static Operation PostOP(string url, Operation operation, bool simulate)
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 try
{ {
...@@ -45,7 +34,7 @@ namespace OnlineStore.Common ...@@ -45,7 +34,7 @@ namespace OnlineStore.Common
{//入库或出库 {//入库或出库
string json = JsonHelper.SerializeObject(operation); string json = JsonHelper.SerializeObject(operation);
LogUtil.error(LOGGER, "模拟HTTP服务器返回出库入库信息:" + json); LogUtil.error( "模拟HTTP服务器返回出库入库信息:" + json);
return operation; return operation;
} }
} }
...@@ -58,9 +47,13 @@ namespace OnlineStore.Common ...@@ -58,9 +47,13 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex); LogUtil.error("PostOP JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex);
}
string result = PostJson(url, json, Encoding.UTF8);
if (operation.op > 0)
{
LogUtil.info("send 【"+url+"】【"+json+"】 " + ",receive 【 " + result+"】");
} }
string result = Post(url, json);
if (!string.IsNullOrEmpty(result)) if (!string.IsNullOrEmpty(result))
{ {
try try
...@@ -69,19 +62,18 @@ namespace OnlineStore.Common ...@@ -69,19 +62,18 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex); LogUtil.error("PostOP JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
} }
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("Post 出错【operation.op=" + operation.op + "】:" + ex); LogUtil.error("PostOP 出错【operation.op=" + operation.op + "】:" + ex);
} }
return null; return null;
} }
public static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open); public static string PostJson(string url, string paramData="", Encoding encoding= null)
public static string Post(string url, string paramData="", Encoding encoding=null)
{ {
if (encoding == null) if (encoding == null)
{ {
...@@ -89,12 +81,9 @@ namespace OnlineStore.Common ...@@ -89,12 +81,9 @@ namespace OnlineStore.Common
} }
if (isLog == 1) if (isLog == 1)
{ {
LOGGER.Info("给服务器发送数据【" + paramData + "】 "); LogUtil.info("PostJson Send【" + paramData + "】 ");
}
if (paramData != "null" && paramData != null)
{
// LogUtil.debug(LOGGER, "HTTP POST to " + url + " \n\t >> " + paramData);
} }
string result = ""; string result = "";
if (url.ToLower().IndexOf("https", System.StringComparison.Ordinal) > -1) if (url.ToLower().IndexOf("https", System.StringComparison.Ordinal) > -1)
...@@ -111,20 +100,16 @@ namespace OnlineStore.Common ...@@ -111,20 +100,16 @@ namespace OnlineStore.Common
wc.Encoding = encoding; wc.Encoding = encoding;
//paramData = Uri.EscapeDataString(paramData); //paramData = Uri.EscapeDataString(paramData);
result = wc.UploadString(url, "POST", paramData); result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result);
} }
catch (Exception e) catch (Exception e)
{ {
LogUtil.error( "POST【"+ paramData + "】 ERROR:" + e.StackTrace, 1); LogUtil.error("PostJson【" + paramData + "】 ERROR:" + e.StackTrace, 1);
}
if (!result.Contains("null") && result.Length != 0)
{
//LogUtil.debug(LOGGER,"receive << " + result);
} }
if (isLog == 1) if (isLog == 1)
{ {
LOGGER.Info("收到服务器数据【" + result + "】"); LogUtil.info("PostJson Revice【" + result + "】");
} }
return result; return result;
} }
...@@ -138,13 +123,13 @@ namespace OnlineStore.Common ...@@ -138,13 +123,13 @@ namespace OnlineStore.Common
{ {
try try
{ {
LogUtil.debug(LOGGER, "HTTP GET FROM: " + url); LogUtil.debug( "HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding }; var wc = new WebClient { Encoding = encoding };
var readStream = wc.OpenRead(url); var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding)) using (var sr = new StreamReader(readStream, encoding))
{ {
var result = sr.ReadToEnd(); var result = sr.ReadToEnd();
LogUtil.debug(LOGGER, "receive << " + result); LogUtil.debug( "receive << " + result);
return result; return result;
} }
} }
...@@ -154,5 +139,65 @@ namespace OnlineStore.Common ...@@ -154,5 +139,65 @@ namespace OnlineStore.Common
} }
return ""; 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 \ No newline at end of file
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
......
...@@ -293,19 +293,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -293,19 +293,6 @@ namespace OnlineStore.DeviceLibrary
public static bool HasChinese(string str) public static bool HasChinese(string str)
{ {
return Regex.IsMatch(str, @"[\u4e00-\u9fa5]"); 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);
}
} }
} }
...@@ -979,9 +979,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -979,9 +979,7 @@ namespace OnlineStore.DeviceLibrary
//温湿度超限报警中超过30分钟 亮 闪 闪 //温湿度超限报警中超过30分钟 亮 闪 闪
//机器未启动 灭 灭 灭 //机器未启动 灭 灭 灭
//机器设备故障(非温湿度)报警 亮 灭 闪 //机器设备故障(非温湿度)报警 亮 灭 闪
//报警时只需要亮红灯
if (storeRunStatus <= StoreRunStatus.Wait) if (storeRunStatus <= StoreRunStatus.Wait)
{ {
if (IOManager.IOValue(IO_Type.Alarm_HddLed).Equals(IO_VALUE.HIGH)) if (IOManager.IOValue(IO_Type.Alarm_HddLed).Equals(IO_VALUE.HIGH))
...@@ -1022,10 +1020,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1022,10 +1020,10 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
if (IOManager.IOValue(IO_Type.Alarm_HddLed).Equals(IO_VALUE.HIGH)) //if (IOManager.IOValue(IO_Type.Alarm_HddLed).Equals(IO_VALUE.HIGH))
{ //{
IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
} //}
} }
bool isBusy = StoreMove.MoveType.Equals(StoreMoveType.InStore) || StoreMove.MoveType.Equals(StoreMoveType.OutStore) || bool isBusy = StoreMove.MoveType.Equals(StoreMoveType.InStore) || StoreMove.MoveType.Equals(StoreMoveType.OutStore) ||
...@@ -1044,7 +1042,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1044,7 +1042,7 @@ namespace OnlineStore.DeviceLibrary
//绿灯亮 //绿灯亮
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
} }
//黄灯 复位待机时灭,出入库或温湿度报警时闪烁 //黄灯 复位待机时灭,出入库或温湿度报警时闪烁
if (isBusy || TempOrHumidityIsAlarm || isTemp30M) if (isBusy || TempOrHumidityIsAlarm || isTemp30M)
{ {
...@@ -1059,10 +1057,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1059,10 +1057,10 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
if (IOManager.IOValue(IO_Type.RunSign_HddLed).Equals(IO_VALUE.HIGH)) //if (IOManager.IOValue(IO_Type.RunSign_HddLed).Equals(IO_VALUE.HIGH))
{ //{
IOManager.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW); IOManager.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
} //}
} }
} }
//仓门打开,打开照明 //仓门打开,打开照明
...@@ -1346,7 +1344,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1346,7 +1344,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LOC = 1; LOC = 1;
} }
string result = HttpHelper.Get(StoreManager.GetAPI("", StoreManager.api_inventory) + "?LOC=" + LOC); string result = HttpHelper.Get(StoreManager.GetAPI( StoreManager.api_inventory) + "?LOC=" + LOC);
if (!String.IsNullOrEmpty(result)) if (!String.IsNullOrEmpty(result))
{ {
List<APIInfo> apilist = JsonHelper.DeserializeJsonToList<APIInfo>(result); List<APIInfo> apilist = JsonHelper.DeserializeJsonToList<APIInfo>(result);
...@@ -1378,7 +1376,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1378,7 +1376,7 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
autoMsg = ResourceControl.GetString("自动出库", "自动出库") + ":RI:" + readId; autoMsg = ResourceControl.GetString("自动出库", "自动出库") + ":RI:" + readId;
result = HttpHelper.Post(StoreManager.GetAPI("", StoreManager.api_stackOut) + "?RIS=" + readId); result = HttpHelper.Post(StoreManager.GetAPI(StoreManager.api_stackOut) + "?RIS=" + readId);
LogUtil.info("自动出入库:自动出库:RI: " + readId + " ," + result); LogUtil.info("自动出入库:自动出库:RI: " + readId + " ," + result);
} }
} }
...@@ -1502,7 +1500,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1502,7 +1500,10 @@ namespace OnlineStore.DeviceLibrary
if ((isInSuddenDown.Equals(false)) && (isNoAirCheck.Equals(false)) && (StoreMove.MoveType.Equals(StoreMoveType.None)) if ((isInSuddenDown.Equals(false)) && (isNoAirCheck.Equals(false)) && (StoreMove.MoveType.Equals(StoreMoveType.None))
&& (storeRunStatus.Equals(StoreRunStatus.Runing))) && (storeRunStatus.Equals(StoreRunStatus.Runing)))
{ {
return true; if (lastPosId.Equals(""))
{
return true;
}
} }
return false; return false;
} }
...@@ -1866,7 +1867,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1866,7 +1867,7 @@ namespace OnlineStore.DeviceLibrary
Operation lineOperation = getLineBoxStatus(); Operation lineOperation = getLineBoxStatus();
string server = ConfigAppSettings.GetValue(Setting_Init.http_server); string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false); Operation resultOperation = HttpHelper.PostOP(StoreManager.GetPostApi(server), lineOperation, false);
//发送状态信息到服务器 //发送状态信息到服务器
if (resultOperation == null ) if (resultOperation == null )
{ {
......
...@@ -112,7 +112,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -112,7 +112,7 @@ namespace OnlineStore.DeviceLibrary
return true; return true;
} }
} }
private DateTime preRWTime = DateTime.Now;
private void CheckWait() private void CheckWait()
{ {
List<WaitResultInfo> list = StoreMove.WaitList; List<WaitResultInfo> list = StoreMove.WaitList;
...@@ -168,16 +168,30 @@ namespace OnlineStore.DeviceLibrary ...@@ -168,16 +168,30 @@ namespace OnlineStore.DeviceLibrary
{ {
timeOutMs = 650000; timeOutMs = 650000;
} }
//if (!wait.IsEnd && span.TotalSeconds > 2 && wait.IoType.Equals(IO_Type.SuckingDisc_Air))
//{ TimeSpan rwSpan = DateTime.Now - preRWTime;
// string ioType = IO_Type.SuckingDisc_Work; if (wait.IsEnd.Equals(false) && rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < 30 && Config.DOList.ContainsKey(wait.IoType))
// IO_VALUE doValue = IOManager.DOValue(ioType); {
// if (!doValue.Equals(wait.IoValue)) preRWTime = DateTime.Now;
// { string msg = " [" + StoreMove.MoveType + "][" + StoreMove.MoveStep + "] " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds, 1) + "秒,重写DO:";
// LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + ioType + "=" + wait.IoValue + ")"); bool isLog = false;
// IOManager.IOMove(ioType, wait.IoValue); 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) if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{ {
ConfigIO io = Config.getWaitIO(wait.IoType); ConfigIO io = Config.getWaitIO(wait.IoType);
...@@ -252,10 +266,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -252,10 +266,12 @@ namespace OnlineStore.DeviceLibrary
} }
else if (span.TotalSeconds > StoreMove.TimeOutSeconds) else if (span.TotalSeconds > StoreMove.TimeOutSeconds)
{ {
string msg = ResourceControl.GetString(ResourceControl.MoveTimeOut, "[" + StoreMove.MoveStep + "]" + string p1 = "[" + StoreMove.MoveStep + "]";
ResourceControl.GetString(ResourceControl.TimeOut, "超时") + "[" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 1) + "]"); 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 + "_" + waitType.ToString().PadLeft(2, '0'); string newType = ResourceControl.MoveTimeOut + "_" + waitType.ToString().PadLeft(2, '0');
SetWaitWarnMsg(msg, newType, StoreMove.MoveStep + "", Math.Round(span.TotalSeconds, 1) + ""); SetWaitWarnMsg(msg, newType, p1, p2,p3);
LogUtil.error(WarnObj.WarnMsg, 15); LogUtil.error(WarnObj.WarnMsg, 15);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnObj.WarnMsg, StoreMove.MoveType); Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnObj.WarnMsg, StoreMove.MoveType);
} }
...@@ -553,8 +569,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -553,8 +569,8 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
} }
else if (StoreMove.MoveStep == StoreMoveStep.SI_14_GoBack) else if (StoreMove.MoveStep == StoreMoveStep.SI_14_GoBack)
{ {
preProTime = DateTime.Now.AddSeconds(-5);
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, " 【" + posId + "】 入库结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!"); LogUtil.info(LOGGER, " 【" + posId + "】 入库结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!");
StoreMove.EndMove(); StoreMove.EndMove();
......
...@@ -376,8 +376,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -376,8 +376,8 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I06_SuckingDisc_Up); StoreMove.NextMoveStep(StoreMoveStep.AUTO_I06_SuckingDisc_Up);
InStoreLog(" 吸盘上升"); InStoreLog(" 吸盘上升");
CylinderMove(IO_Type.ClampingDisc_Up, IO_Type.ClampingDisc_Down, false); CylinderMove(IO_Type.ClampingDisc_Up, IO_Type.ClampingDisc_Down, true);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampingDisc_Down, IO_VALUE.LOW)); //StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampingDisc_Down, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1500)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1500));
} }
...@@ -479,7 +479,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -479,7 +479,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(Name + StoreMove.MoveStep + "入料: 从服务器获取入库PosId,尺寸:【" + LastWidth + "*" + LastHeight + "】二维码【" + LastCode + "】"); LogUtil.debug(Name + StoreMove.MoveStep + "入料: 从服务器获取入库PosId,尺寸:【" + LastWidth + "*" + LastHeight + "】二维码【" + LastCode + "】");
GetInStorePosId(ProcessMsg()); GetInStorePosId(ProcessMsg());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(3000)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(5000));
} }
} }
else if (span.TotalSeconds > 60) else if (span.TotalSeconds > 60)
...@@ -514,6 +514,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -514,6 +514,7 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
InStoreLog(" 入库失败,尺寸:【" + LastWidth + "*" + LastHeight + "】将料盘送出,等待料盘拿走"); InStoreLog(" 入库失败,尺寸:【" + LastWidth + "*" + LastHeight + "】将料盘送出,等待料盘拿走");
StoreManager.cancelPutInTask(LastSendCode);
SendTrayOut(); SendTrayOut();
} }
} }
......
...@@ -75,6 +75,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -75,6 +75,9 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
protected static DateTime preRWTime = DateTime.Now;
private static void CheckWait() private static void CheckWait()
{ {
List<WaitResultInfo> list = StoreMove.WaitList; List<WaitResultInfo> list = StoreMove.WaitList;
...@@ -110,43 +113,46 @@ namespace OnlineStore.DeviceLibrary ...@@ -110,43 +113,46 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType == (int)Wait_Type.IOMove_2) else if (wait.WaitType == (int)Wait_Type.IOMove_2)
{ {
wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue); wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue);
//int timeOutMs = StoreManager.Config.IOSingle_TimerOut;
//timeOutMs = 20;
//if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
//{
// ConfigIO io = StoreManager.Config.getWaitIO(wait.IoType);
// WarnMsg = "[" + StoreMove.MoveStep + "] 等待[" + io.ElectricalDefinition + "_" + io.Explain + "=" + wait.IoValue + "]超时";
// StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType);
// LogUtil.error(WarnMsg, 101);
// isOk = false;
// break;
//}
//如果是气缸动作,若Do未输出,重新写一遍 //如果是气缸动作,若Do未输出,重新写一遍
if (!wait.IsEnd && span.TotalSeconds > 2) //if ((!wait.IsEnd )&& span.TotalSeconds > 2)
//{
// if (wait.IoType.Equals(IO_Type.ClampingDisc_Down) || wait.IoType.Equals(IO_Type.ClampingDisc_Up))
// {
// IO_VALUE doValue = IOManager.DOValue(wait.IoType);
// if (!doValue.Equals(wait.IoValue))
// {
// LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + wait.IoType + "=" + wait.IoValue + ")");
// IOManager.IOMove(wait.IoType, wait.IoValue);
// string ioType = wait.IoType.Equals(IO_Type.ClampingDisc_Down) ? IO_Type.ClampingDisc_Up : IO_Type.ClampingDisc_Down;
// IO_VALUE ioValue = wait.IoValue.Equals(IO_VALUE.LOW) ? IO_VALUE.HIGH : IO_VALUE.LOW;
// LogUtil.error("等待[" + wait.ToStr() + "],重写气缸DO(" + ioType + "=" + ioValue + ")");
// IOManager.IOMove(ioType, ioValue);
// }
// }
//}
TimeSpan rwSpan = DateTime.Now - preRWTime;
if (wait.IsEnd.Equals(false) && rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < 30 && StoreManager.Store.Config.DOList.ContainsKey(wait.IoType))
{ {
if (wait.IoType.Equals(IO_Type.ClampingDisc_Down) || wait.IoType.Equals(IO_Type.ClampingDisc_Up)) preRWTime = DateTime.Now;
string msg = " [" + StoreMove.MoveType + "][" + StoreMove.MoveStep + "] " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds, 1) + "秒,重写DO:";
bool isLog = false;
foreach (WaitResultInfo ww in list)
{ {
IO_VALUE doValue = IOManager.DOValue(wait.IoType); if (ww != null && ww.WaitType.Equals(2) && StoreManager.Store.Config.DOList.ContainsKey(ww.IoType))
if (!doValue.Equals(wait.IoValue))
{ {
LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + wait.IoType + "=" + wait.IoValue + ")"); if (IOManager.DOValue(ww.IoType).Equals(ww.IoValue).Equals(false))
IOManager.IOMove(wait.IoType, wait.IoValue); {
string ioType = wait.IoType.Equals(IO_Type.ClampingDisc_Down) ? IO_Type.ClampingDisc_Up : IO_Type.ClampingDisc_Down; isLog = true;
IO_VALUE ioValue = wait.IoValue.Equals(IO_VALUE.LOW) ? IO_VALUE.HIGH : IO_VALUE.LOW; IOManager.IOMove(ww.IoType, ww.IoValue);
LogUtil.error("等待[" + wait.ToStr() + "],重写气缸DO(" + ioType + "=" + ioValue + ")"); msg += ww.ToStr() + ",";
IOManager.IOMove(ioType, ioValue); }
} }
} }
//else if (wait.IoType.Equals(IO_Type.SuckingDisc_Air)) if (isLog)
//{ {
// string ioType = IO_Type.SuckingDisc_Work; LogUtil.error(Name + msg);
// IO_VALUE doValue = IOManager.DOValue(ioType); }
// if (!doValue.Equals(wait.IoValue))
// {
// LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + ioType + "=" + wait.IoValue + ")");
// IOManager.IOMove(ioType, wait.IoValue);
// }
//}
} }
} }
else if (wait.WaitType == (int)Wait_Type.Time_3) else if (wait.WaitType == (int)Wait_Type.Time_3)
...@@ -164,7 +170,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -164,7 +170,7 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType == (int)Wait_Type.BatchAxisMove_10) else if (wait.WaitType == (int)Wait_Type.BatchAxisMove_10)
{ {
wait.IsEnd = BatchAxisIsEnd(wait,span); wait.IsEnd = BatchAxisIsEnd(wait, span);
if (wait.IsEnd) if (wait.IsEnd)
{ {
BatchAxisController.StopCheck(); BatchAxisController.StopCheck();
...@@ -393,7 +399,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -393,7 +399,7 @@ namespace OnlineStore.DeviceLibrary
IOManager.IOMove(lowType, IO_VALUE.LOW); IOManager.IOMove(lowType, IO_VALUE.LOW);
IOManager.IOMove(highType, IO_VALUE.HIGH); IOManager.IOMove(highType, IO_VALUE.HIGH);
} }
private static string LastSendCode = "";
public static string ProcessMsg() public static string ProcessMsg()
{ {
string msg = ""; string msg = "";
...@@ -421,6 +427,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -421,6 +427,8 @@ namespace OnlineStore.DeviceLibrary
{ {
msg = msg + "=1+0x0-" + LastWidth + "x" + LastHeight + "=" + LastCode + spiltStr; msg = msg + "=1+0x0-" + LastWidth + "x" + LastHeight + "=" + LastCode + spiltStr;
} }
msg = CodeManager.ReplaceCode(msg);
LastSendCode = msg;
return msg; return msg;
} }
//=1+0x0-13x24=201810220856;025;5N02018101;121;700012865;92498;1800;## //=1+0x0-13x24=201810220856;025;5N02018101;121;700012865;92498;1800;##
...@@ -484,7 +492,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -484,7 +492,7 @@ namespace OnlineStore.DeviceLibrary
public static InOutStoreParam GetInStoreParam(string LogName, string message) public static InOutStoreParam GetInStoreParam(string LogName, string message)
{ {
message = CodeManager.ReplaceCode(message); //message = CodeManager.ReplaceCode(message);
if (message.Equals("") || string.IsNullOrEmpty(message)) if (message.Equals("") || string.IsNullOrEmpty(message))
{ {
CodeMsg =ResourceControl.GetString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘"); CodeMsg =ResourceControl.GetString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘");
...@@ -520,7 +528,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -520,7 +528,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug("添加自动入库库位号:" + autoposId); LogUtil.debug("添加自动入库库位号:" + autoposId);
} }
string server = ConfigAppSettings.GetValue(Setting_Init.http_server); string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false); Operation resultOperation = HttpHelper.PostOP(StoreManager.GetPostApi(server), operation, false);
if (resultOperation == null) if (resultOperation == null)
{ {
......
...@@ -21,6 +21,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -21,6 +21,8 @@ namespace OnlineStore.DeviceLibrary
public static string api_inventory = "rest/api/v2/mes/inventory";//获取单个或全总SMD-BOX 中的实时库存信息 public static string api_inventory = "rest/api/v2/mes/inventory";//获取单个或全总SMD-BOX 中的实时库存信息
public static string api_stackOut = "rest/api/v2/mes/stackOut";//本接⼜提供物料出库功能,可⼀次性出单/多盘物料 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 readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static AC_SA_BoxBean Store = null; public static AC_SA_BoxBean Store = null;
...@@ -98,11 +100,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -98,11 +100,7 @@ namespace OnlineStore.DeviceLibrary
Application.Exit(); Application.Exit();
} }
return Store; return Store;
} }
/// <summary>
/// 修改了料仓配置,更新缓存,更新配置文件(只能更新PRO的配置)
/// </summary>
/// <param name="kTK_LA_Store_Config"></param>
public static void UpdateBoxConfig(AUTO_SA_Config storeConfig) public static void UpdateBoxConfig(AUTO_SA_Config storeConfig)
{ {
try try
...@@ -129,11 +127,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -129,11 +127,22 @@ namespace OnlineStore.DeviceLibrary
host = GetHostUrl(host); host = GetHostUrl(host);
return host + api_communication; 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); string host = GetHostUrl("");
return host + api; 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) private static string GetHostUrl(string host)
...@@ -154,6 +163,56 @@ namespace OnlineStore.DeviceLibrary ...@@ -154,6 +163,56 @@ namespace OnlineStore.DeviceLibrary
} }
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 + "】");
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 class ReviceData
{
//{"code":0,"msg":"ok","data":"7"}
public int code { get; set; }
public string msg { get; set; }
public Dictionary<string, string> data { get; set; }
} }
public class APIInfo public class APIInfo
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!