Commit e7e4c3f2 LN

自动出库功能修改

1 个父辈 cc4ed631
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
<!--配置文件的表头格式,0=中文,1=英文--> <!--配置文件的表头格式,0=中文,1=英文-->
<add key ="LibNameType" value ="0"/> <add key ="LibNameType" value ="0"/>
<add key="DefaultPWD" value ="123456"/> <add key="DefaultPWD" value ="123456"/>
<!--自动出入库时使用-->
<add key ="LOC" value ="1"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -98,5 +98,6 @@ namespace OnlineStore.Common ...@@ -98,5 +98,6 @@ namespace OnlineStore.Common
public static string LibNameType = "LibNameType"; public static string LibNameType = "LibNameType";
public static string DefaultPWD = "DefaultPWD"; public static string DefaultPWD = "DefaultPWD";
public static string LOC = "LOC";
} }
} }
...@@ -138,13 +138,13 @@ namespace OnlineStore.Common ...@@ -138,13 +138,13 @@ namespace OnlineStore.Common
{ {
try try
{ {
LogUtil.info(LOGGER, "HTTP GET FROM: " + url); LogUtil.debug(LOGGER, "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.info(LOGGER, "receive << " + result); LogUtil.debug(LOGGER, "receive << " + result);
return result; return result;
} }
} }
......
...@@ -1208,6 +1208,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1208,6 +1208,7 @@ namespace OnlineStore.DeviceLibrary
} }
private DateTime preProTime = DateTime.Now; private DateTime preProTime = DateTime.Now;
private void AutoResetProcess() private void AutoResetProcess()
{ {
try try
...@@ -1279,25 +1280,41 @@ namespace OnlineStore.DeviceLibrary ...@@ -1279,25 +1280,41 @@ namespace OnlineStore.DeviceLibrary
{ {
//获取出库的库位号 //获取出库的库位号
string readId = ""; string readId = "";
//[{"LOC":"1","RI":"A100007","QTY":1000,"PN":"pn"},{"LOC":"2","RI":"A100015","QTY":1000,"PN":"pn"}]
//http://[SMD-BOX-IP]:[SMD-BOX-Port]/rest/api/v2/mes/inventory //http://[SMD-BOX-IP]:[SMD-BOX-Port]/rest/api/v2/mes/inventory
string result = HttpHelper.Post(StoreManager.GetAPI("", StoreManager.api_inventory)); //http://localhost/myproject/rest/api/v2/mes/inventory?LOC=1
if (!String.IsNullOrEmpty(result)) int LOC = ConfigAppSettings.GetIntValue(Setting_Init.LOC);
if (LOC <= 0)
{ {
string[] rArray = result.Split('}'); LOC = 1;
foreach (string obj in rArray) }
string result = HttpHelper.Get(StoreManager.GetAPI("", StoreManager.api_inventory) + "?LOC=" + LOC);
if (!String.IsNullOrEmpty(result))
{ {
string[] objArray = obj.Split(','); List<APIInfo> apilist = JsonHelper.DeserializeJsonToList<APIInfo>(result);
if (objArray.Length >= 4) foreach (APIInfo a in apilist)
{ {
string rId = objArray[1]; if (a.LOC.Equals(LOC))
if (rId.Length > 7)
{ {
readId = rId.Substring(6, rId.Length - 7); readId = a.RI;
LogUtil.debug("自动出入库:查找到:RI: " + readId); LogUtil.debug("自动出入库:查找到:RI: " + readId);
break;
}
} }
} }
//string[] rArray = result.Split('}');
//foreach (string obj in rArray)
//{
// string[] objArray = obj.Split(',');
// if (objArray.Length >= 4)
// {
// string rId = objArray[1];
// if (rId.Length > 7)
// {
// readId = rId.Substring(6, rId.Length - 7);
// LogUtil.debug("自动出入库:查找到:RI: " + readId);
// break;
// }
// }
//}
} }
if (readId.Equals("")) if (readId.Equals(""))
{ {
...@@ -1938,7 +1955,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1938,7 +1955,10 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + " 执行出库【" + currInOutFixture.ToStr() + "】失败,加入等待队列"); LogUtil.info(LOGGER, StoreName + " 执行出库【" + currInOutFixture.ToStr() + "】失败,加入等待队列");
AddWaitOutInfo(currInOutFixture); AddWaitOutInfo(currInOutFixture);
} }
if(autoNext) autoMsg = "自动出库:" + posId; if (autoNext)
{
autoMsg = "自动出库:" + posId;
}
} }
else else
{ {
......
...@@ -233,6 +233,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -233,6 +233,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error(Name + moveAxis.DisplayStr + "目标[" + targetPosition + "]当前[" + outCount + LogUtil.error(Name + moveAxis.DisplayStr + "目标[" + targetPosition + "]当前[" + outCount +
"],误差过大,重新运动,剩余[" + StoreMove.CanWhileCount + "]次"); "],误差过大,重新运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.SuddenStop(moveAxis.DeviceName, moveAxis.GetAxisValue());
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
StoreMove.CanWhileCount--; StoreMove.CanWhileCount--;
} }
......
...@@ -152,5 +152,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,5 +152,17 @@ namespace OnlineStore.DeviceLibrary
} }
return host; return host;
} }
}
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 string QTY = "";
public string PN = "";
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!